• Resolved landwire

    (@landwire)


    Some image files do not get converted. Does the conversion work on the uploads directory or does it go through all the defined image sizes? The later seems to be the case, right?

    I am creating some on the fly image sizes with
    $figure['src'] = Timber\ImageHelper::resize($timber_image->src($imageSize), $width, $height);.
    So for instance this image:
    Detail_Rosen-Poolbeet-Hausen-1280×960.jpg
    gets a version like this:
    Detail_Rosen-Poolbeet-Hausen-1280×960-1600×1066.656-c-default.jpg

    See: https://timber.github.io/docs/reference/timber-imagehelper/#resize

    Those images are saved in the uploads folder just beside the original file, but they do not get converted. Would it be possible to add a switch/checkbox in the plugin or a filter again to force conversion of all images inside the uploads folder?

    Thanks again!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Hi @landwire,

    Thank you for your message.

    The plugin uses the WordPress filter wp_update_attachment_metadata, which is used when generating new image sizes. Then it generates files in the WebP format.

    In a situation when you convert all images, the plugin uses the function wp_get_attachment_metadata to take all paths to different sizes of images.

    Remember, however, that if the size of the converted WebP file is larger than the original, it is not used. This happens when you use additional compression before.

    Thread Starter landwire

    (@landwire)

    Ok. Those image sizes generated by timber are not registered with WordPress, so that is why they do not get converted by your plugin.

    Would be nice to have an additional button “Regenerate all images in Uploads” that would just run over each file in there (regardless if registered with wordpress or not), if that is at all possible. Basically the paths fed into public function convertImage($path, $quality) would just be all the paths of all images in uploads folder instead of getting the paths from the wordpress registered images sizes.

    Of course that is a manual action and cannot be automated on uploading an image.

    Anyway, might be too specific for your plugin, but somehow it would be nice to get all images in uploads converted.

    Thanks for your plugin!

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    I need some way to download all files. And above all, to convert them when uploading. Do you have any idea for this?

    Thread Starter landwire

    (@landwire)

    I was thinking of just running through the uploads directory file by file.

    But I do not fully understand how your code works, so I can unfortunately not make any suggestion.

    Do not worry. It is maybe a bit too special for your plugin.

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Sorry, but taking all the files is impossible.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Some image files do not get converted’ is closed to new replies.