Plugin Author
RazyRx
(@razyrx)
Hi @howdy_mcgee,
Plugin only replace one image with another, but do not generate another sizes. It must be generated by WordPress same as it generate it for new images.
Regards,
Oleg
Hello @razyrx,
WordPress is generating the expected image sizes.
The problem is that in the WooCommerce gallery it’s not pulling the Gallery Thumbnail size. Instead it pulls the full image and sizes it down ( in the browser ) to 100×100. This isn’t optimal for large uploaded images, for example it could pull a 2000×2000 image and size it down to a 100×100 just for the gallery image where it should pull the 100×100 image instead.
If I disable the Product Watermark for WooCommerce
and upload an image to the gallery it gets pulled into the product gallery at the expected 100×100. If I enable the Product Watermark for WooCommerce
and upload an image to the gallery it gets pulled into the product gallery at the unexpected full image size.
You can see this by spinning up a vanilla Storefront WooCommerce Store with default products. I’m not sure why it happens but it appears to be specific to this plugin.
I’ve made an Imgur gallery with the two examples: https://imgur.com/a/o0GbdVS
The First Image is with the watermark plugin disabled and the two images reuploaded. The correct sizes are pulled into the WooCommerce Gallery.
The Second Image is with the watermark plugin enabled and the two images reuploaded. The watermark is applied and the full image sizes are pulled into the WooCommerce Gallery instead of 100×100 expected images.
The Third Image is all the generated image sizes. You can see the 100×100 is being generated corrected but not pulled correctly.
I’m not quite sure why it’s not pulling the generated 100×100 image size that’s being generated by this plugin but if I disable the plugin it does pull the correct image size. Hopefully that makes sense and you’re able to replicate the issue.
Hello and Happy New Year!
I think the core of the issue is that whenever this plugin generates the metadata for the additional image sizes something is going wrong. In the database, only medium
and medium_large
sizes are being saved into the _wp_attachment_metadata
serialized array. So while all the sizes are being generated on the file-system, they’re not being saved into this meta value. This means that when WordPress ( or in this case WooCommerce ) goes to get an image of a specific size and the database ( _wp_attachment_metadata ) tells WordPress that this size doesn’t exist, it pulls the full image instead.
We know this to be true if we inspect the WooCommerce gallery main image. WooCommerce uses JS to generate the flex-slider gallery and it requires the data-thumb
attribute to pull the correct thumbnail size, which is pulled from the generated _wp_attachment_metadata
meta value.
This seems to be rooted in two sections:
The LN 278 conditional
product-watermark-for-woocommerce\main.php
The intermediate_image_sizes_advanced()
method LN 499
product-watermark-for-woocommerce\main.php
If I comment out the filters to intermediate_image_sizes_advanced
and upload an image it works as expected, pulls the correct image size, and doesn’t seem to generate any unexpected image sizes. I’m not entirely certain why the add/remove filters exist here but that seems to be the core of the issue.
Hopefully this makes sense and you have a chance to look into it yourself. Have a wonderful rest of your week!
Hello,
We will check it asap and get back to you.
Regards,
Dima
Hello,
I was wondering if there was any update on this issue. Is there any further debug / information I can provide or anything I can do to help fix this issue?
Hello,
This appears to still be an issue. If you need more information to replicate the issue or apply a patch for the issue please let me know.