Is there support for plugins that convert existing images (JPG/PNG) to WebP? If so, do you have any recommendations?
PS. Thank you for continuing the great work done on the Fly plugin ??
]]>Does this plugin fix CLS issues by applying image height and width attributes to images?
]]>Hi,
After switching over from Fly Dynamic we’ve recently encountered significant performance issues with the Better Image Sizes plugin, which has begun generating an excessive number of calls. In some instances, these calls have exceeded 400,000, leading to substantial spikes in our memory usage. This has severely impacted the overall performance and stability of our sites using the plugin.
Upon investigation, we identified that this problem arises specifically when we use the pre-existing function fly_get_attachment_image()
which then calls bis_get_attachment_image_attributes
filter.
Are you able to look into this or provide some help in stopping this from occurring.
Thanks
I would love to help contribute to this, but I hate dealing with SVN. Is there a GitHub or similar repo? We maintain a WP plugin and actually use a GitHub action to publish directly to SVN whenever we need to tag a release.
Specifically I’d like to address the constructor for Better_image_sizes_resizer
which I think should be turned into a singleton. Right now, when calling any of the helper functions such as bis_get_attachment_image_src
, they invoke the constructor each time which needlessly re-registers actions each time. I haven’t found any bugs related to this, but it seems like it would be a small performance win.
Hi there, we’re looking to use this on various client sites as a replacement to the Fly Dynamic Image Resizer plugin. Out of the box this appears to work correctly with no changes. However, I’m trying to test out the focal point functionality, but whenever I select a focal point and update the image, the focal point is never saved. So when I revisit the image, the focal point is always set back to the default 50% 50%. Any ideas?
]]>We have custom fields where a customer can upload an icon – sometimes they provide a png but sometimes it’s an SVG. With fly images it threw an error if SVG was passed through.
Would be a great addition to this plugin if an SVG was simply ignored and the original URL returned.
Thanks for a great plugin continuing and improving Fly’s work.
]]>First of thank you for creating this plugin!
I just installed the plugin and testing in my code:
$book = pods( 'book', $en_id);
echo bis_get_attachment_picture( $book->field( 'book_cover', TRUE )['ID'], [ 575 => [ 232, 350 ], 767 => [ 464, 700 ], ] );
and the output is:
<picture>
<source media="(max-width:575px)" srcset="https://mysite.com/wp-content/uploads/2023/02/ORIGINAL_FILE.jpg">
<source media="(max-width:767px)" srcset="https://mysite.com/wp-content/uploads/2023/02/ORIGINAL_FILE.jpg">
<source media="(min-width:768px)" srcset="https://mysite.com/wp-content/uploads/2023/02/ORIGINAL_FILE.jpg">
<img width="795" height="1200" src="https://mysite.com/wp-content/uploads/2023/02/ORIGINAL_FILE.jpg" class="attachment-full size-full" alt="" decoding="async" style="width:100%;height:150.94%;max-width:795px;">
</picture>
The file referred is always the original file and in the folder wp-content/uploads/bis-images/
is empty, what are the requirements to make the plugin work ?
Thank you
]]>Hi, i already have lot of images. Is it possible to delete all variations of existing images and regenerate only required sizes using this plugin instead of only for newly upload images?
]]>Thank you for picking up where fly_image left off. I found that two weeks before it was shut down.
Somehow I managed to change the fly image directory to [uploads]/_img/.
What would it take to change the save path in your plugin?
bis_get_attachment_picture doesn’t support cropping for default image, which is required in my case. I wrote custom function by modifying bis_get_attachment_picture. Instead of number you can pass “default” as break-point and it is used as default settings . Maybe you can add it to the plugin code, here is my code:
function custom_bis_get_attachment_picture( $attachment_id = 0, $sizes = array(), $attr = array() ){
if( $attachment_id < 1 || ! is_array( $sizes ) || count( $sizes ) === 0 ){
return '';
}
ksort( $sizes );
$last_breakpoint = 0;
$html = '<picture>';
$default_srcset = "";
foreach( $sizes as $breakpoint => $data ){
if( (intval( $breakpoint ) || $breakpoint == 'default') && count( $data ) >= 2 ){
$img = bis_get_attachment_image_src( $attachment_id, array( $data[0], $data[1] ), isset( $data[2] ) ? $data[2] : false );
if( $img ){
if( isset( $attr['retina'] ) && $attr['retina'] ){
$retina = bis_get_attachment_image_src( $attachment_id, array( $data[0] * 2, $data[1] * 2 ), isset( $data[2] ) ? $data[2] : false );
$srcset = $img['src'] . ' 1x, ' . $retina['src'] . ' 2x';
}else{
$srcset = $img['src'];
}
if ($breakpoint == 'default') {
$default_srcset = $srcset;
} else {
$html .= '<source media="(max-width:' . intval( $breakpoint ) . 'px)" srcset="' . $srcset . '">';
$last_breakpoint = intval( $breakpoint );
}
}
}
}
$html .= '<source media="(min-width:' . ( $last_breakpoint + 1 ) . 'px)" srcset="' . (empty($default_srcset) ? wp_get_attachment_url( $attachment_id ) : $default_srcset) . '">';
if (empty($default_srcset)) {
$html .= wp_get_attachment_image( $attachment_id, 'full', false, $attr );
} else {
$html .= bis_get_attachment_image($attachment_id, [$sizes['default'][0], $sizes['default'][1]], $sizes['default'][2], $attr);
}
$html .= '</picture>';
return apply_filters( 'bis_get_attachment_picture', $html, $attachment_id, $sizes, $attr );
}
]]>
I have the option to Pick and Save a Focal Point.
When I click Regenerate the defined focal point has no effect, the images are cropped from the center as usual.
However I am on WP 6.2
]]>Hi,
First of all your plugin rocks ! You’ve made a great job, congratulations.
It works pretty well for me.
The only thing i don’t understand is why you put width ad height attribute to the img tag inside picture tag ? I use picture tag for art direction, so the aspect ratio of my images is different for each scrset. fixed a width and height don’t work for me.
Is it a way to disable it ?
Thanks for your time, and again thanks for your plugin !
Nauar.
]]>Hey,
plugin is throwing fatal error on line wp-content/plugins/better-image-sizes/resizer/index.php:257
.
It is missing a second argument for array_combine
function.
Can you please fix it? Thanks