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

    (@tinypng)

    Hi Richard,

    It is always tricky when multiple plugins are modifying the functionality of WordPress. We cannot test every combination of plugins, and unfortunately the WPML plugin is not one that we have tested yet together with our TinyPNG/TinyJPG plugin.

    We will see if we can test and support it with a future version of our plugin.

    Thread Starter Richard K

    (@rkorebrits)

    Thanks. It’s not just necessarily WPML, but just the fact that exact duplicate images are listed. Surely it can’t be that hard to filter this?

    Thread Starter Richard K

    (@rkorebrits)

    Replace count query

    SELECT COUNT(*) AS<code>count</code>
            FROM $wpdb->posts
           WHERE post_type = 'attachment'
             AND post_mime_type LIKE 'image/%'
        ORDER BY ID DESC

    by

    SELECT *
            FROM $wpdb->posts
           WHERE post_type = 'attachment'
             AND post_mime_type LIKE 'image/%'
        GROUP BY guid

    in bulk_compress_page to fix the count

    and for the actual items, replace

    SELECT ID, post_title
        FROM $wpdb->posts
       WHERE post_type = 'attachment'
         AND post_mime_type LIKE 'image/%' $cond
    ORDER BY ID DESC

    by

    SELECT ID, post_title
        FROM $wpdb->posts
       WHERE post_type = 'attachment'
         AND post_mime_type LIKE 'image/%' $cond
    GROUP BY GUID
    ORDER BY ID DESC

    Edit

    COUNT of course doesn’t work with the group by statement :facepalm:, but at least the actual query will remove duplicates.

    Plugin Author TinyPNG

    (@tinypng)

    Ordinarily there should be no way for images to be duplicated in WordPress. WordPress assumes you upload an image once, and then attach it to multiple posts. WPML changes that assumption. That’s one of the challenges of developing extensions for WordPress. Plugins can change how WordPress behaves and do whatever they want.

    The actual file name is stored in the post metadata, in _wp_attached_file. In principle it might be possible to filter out duplicates this way. Using the GUID is not a great solution because there’s no guarantee this field is identical if the image is duplicated. In fact, it is supposed to be globally unique.

    It certainly is possible, but it’s slightly more tricky than it may seem. And WPML is not an open source plugin, so it is very difficult for us to test. Nevertheless I have added the suggestion to our list!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Doesn't support WPML’ is closed to new replies.