• Resolved cleemas

    (@cleemas)


    Hello,

    I’ve been using your plugin for a long time and I’m extremely satisfied. However, I came across one problem with which I can not give advice. I have an advertising portal where users register and then insert an advertisement with photos. Last year 2019 the plugin worked correctly. As soon as the new year 2020 arrived, the compression stopped working.

    I can’t even use compression in the media library for images uploaded by users. Compression works only on images that I insert directly in the media library.

    Saving images to: wp-content / uploads / [year] / [month]

    Can you help me pls?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author TinyPNG

    (@tinypng)

    Hi there,

    Thanks for reaching out to us!

    Can you try to temporarily deactivate our plugin and see if you are able to upload images to your portal in general?

    I’m looking forward hearing from you!

    Thread Starter cleemas

    (@cleemas)

    Hello,

    yes I can add images when I deactivate / remove plugin. The problem is that I/they added images in the new year I can not use compression and I do not know what the reason.

    Plugin Author TinyPNG

    (@tinypng)

    Thanks for your reply. Do you receive any error messages as to why it doesn’t work, either in your WordPress site or in the log files of the server?
    Would you be able to share your findings at [email protected]?

    Thanks!

    Thread Starter cleemas

    (@cleemas)

    A message from support that helped me solve my problem:

    “The only explanation we have at this point is that somewhere in the process of uploading the image to your WordPress media library a different script or plugin changes the meta data of the JPG file to a format our plugin does not understand. Our plugin does not check for file extension, but looks at the meta data within the image to see if it can compress it or not. For JPG files the expected MIME-type is “image/jpeg”.

    Wordpress saves this information in the wp_postmeta tables (see attached image), can you look for a specific image which fails (e.g. it2-2-1.jpg) and check what kind of Meta data is saved?”

    Based on this, I found that the uploaded *.jpg images stores bad metadata. The “Compress JPEG & PNG images” plugin doesn’t work with them.

    I found this function in my code that caused the problem:

    / *
    Allow SVG file format
    * /
    function classifieds_mime_types ($ mimes) {
    $ mimes [‘svg’] = ‘image / svg + xml’;
    if (! current_user_can (‘manage_options’)) {
    $ mimes = array
    ‘jpg’ => ‘image / jpg’, I replaced it with ‘jpg’ => ‘image / jpeg’ then it worked
    ‘jpeg’ => ‘image / jpeg’
    ‘gif’ => ‘gif’
    ‘png’ => ‘image / png’
    );
    }

    return $ mimes;
    }

    Thank you for your help and apologize for my English. ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Compression does not work’ is closed to new replies.