• Resolved igortitarenko

    (@igortitarenko)


    Hello.

    Your plugin interferes with wp_generate_attachment_metadata() WordPress function (wp-admin/includes/image.php).

    When reSmush.it is active, wp_generate_attachment_metadata() returns (bool)true instead of Array with metadata. Converted to string it means “1” in the database.

    If plugin like “Regenerate Thumbnails” is used while reSmush.it is active, all metadata for images gets removed from the database.

    Steps to reproduce:
    1) Install and activate reSmush.it plugin
    2) Install and activate “Regenerate Thumbnails” plugin
    3) Regenerate ALL thumbnails

    OR

    1) Install and activate reSmush.it plugin
    2) Try to return value for one of images with the following code:
    require_once( ABSPATH . ‘wp-admin/includes/image.php’ );
    var_dump( wp_generate_attachment_metadata( ‘39715’, ‘/var/www/website/wp-content/uploads/2019/01/image.jpg’ ) );

    Don’t give me your usual bullshit about custom Media Libraries or galleries – I have none!
    Your plugin leads to removal of all attachments metadata. Deal with it.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter igortitarenko

    (@igortitarenko)

    The code that causes the issue is located at resmushit.php at lines 125-127
    if(get_option(‘resmushit_on_upload’) OR ( isset($_POST[‘action’]) AND $_POST[‘action’] === “resmushit_bulk_process_image” )) {
    add_filter(‘wp_generate_attachment_metadata’, ‘resmushit_process_images’);
    }

    This filter – ‘wp_generate_attachment_metadata’ – is used in wp-admin/includes/image.php to return metadata from wp_generate_attachment_metadata() function.

    Plugin Contributor reSmush.it

    (@resmushit)

    Hi Igor,

    Thanks for this kind feedback, we’ve released a new version today which should solve your problems.

    Keep us posted.
    Cheers,
    Charles

    Ryan

    (@dalefoxwiz)

    What a life saver on this today. I was wondering what’s causing the issue on our woocommerce product thumbnails sizes on our site. Surely also took my time for a while today until it came down to this. Just in time for the update fix. Thanks

    • This reply was modified 6 years, 2 months ago by Ryan.
    Thread Starter igortitarenko

    (@igortitarenko)

    Hi Charles,

    Thanks for the fix.
    There is something I want to add.

    In other topics which describe the same problem you refer to some rare/unusual WP configurations. Usage of core WordPress function is not a rare or unusual configuration/operation. Moreover, talking about configurations is incorrect.

    The problem is not in configurations. The problem is in your irresponsibility. You hijacked WordPress core function by replacing WordPress filter with your own and changed default output from Array to Boolean. You can’t do something like that to your users. If you need to overwrite WordPress filter with your own version of it for the purpose of image optimization, you need to be more careful with how it can affect filter in question. So please be more careful in the future.

    • This reply was modified 6 years, 2 months ago by igortitarenko.
    Plugin Contributor reSmush.it

    (@resmushit)

    You’re welcome @dalefoxwiz ??

    @igortitarenko : The error wasn’t intentional (like a bug is!) and our previous answers are — I admit — a misreading of other WP Galleries. Howover, I’m not sure you use the best way to report a bug with such a tough way of talking. We work for free for the community, and we provide a free API to the community on different platforms. If you don’t agree with our way of work, two. solutions : contribute to the code (would be helpful and really appreciated), or report gently a bug, instead of patronizing us, so you’ll be considered by the community ??

    Cheers,
    Charles

    Thread Starter igortitarenko

    (@igortitarenko)

    @resmushit :

    I’m sorry for my tough way of talking and for patronizing you, Charles. Your unintentional error have cost me hours of trouble.

    I understand that you work for free and that you don’t own me anything (any paid version with WebP support coming? – I think I’d pay for it). And I probably wouldn’t say something like that if it was a bug in a plugin-specific code.

    However, I do stand on my words that you need to treat interference in core WordPress functions more carefully. Removing data from website databases this way is not OK, even if there are backups and ways to rebuild it.

    Hi @resmushit

    Thanks for fixing this, this happened to me a while ago when using regenerate thumbnails and I assumed it was a problem with that plugin. Thankfully I had a database backup I was able to restore.

    Question – do I now need to resmush my whole image library, or is this not anything to do with the image data, and so I can now just use regenerate thumbnails without the risk of losing all my thumbnails?

    Thanks!

    Laurence

    Plugin Contributor reSmush.it

    (@resmushit)

    Hi guys!

    @igortitarenko : be patient, webp is coming ??
    @lozula : No you don’t need to re-execture a whole optimization, the bug was due to a code that returned “on the fly” wrong data. So you can regenerate thumbnails if you want. In such big operations, having a backup is still a good idea ?? ??

    Cheers,
    Charles

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Plugin interferes with wp_generate_attachment_metadata()’ is closed to new replies.