1

I have switched the Image toolkit from GD2 to Imagemagick. It’s working great for new images, however previously uploaded images still show up with lowres quality.

How can I regenerate ALL images using Imagemagick?

I've followed up: Rebuild images from image style

  • drush: drush image-flush mystyle
  • rm -rf sites/default/files/styles
  • Clearing Caches a couple of times and hit save on all image styles.

However all images still show up with lowres quality. When I manually update a node, the image quality looks correct. Also, the file size changes. Looks like imagemagick isn’t triggered. What can I do?

  • 3
    If saving a node fixes it a quick solution would be to save them all – Clive Oct 19 '17 at 21:48
  • Saving a node doesn't fix it. I have to delete the image and upload it again, which is not a quick solution. – howdytom Oct 19 '17 at 23:20
  • Are the originals definitely high quality? Are you using Chrome? If you are do you have the dev tools open and "Disable cache" selected in the network tab? – Clive Oct 19 '17 at 23:25
  • Yes, original image file size 1MB. I am using Apple Safari and Coogle Chrome. Cache has been disabled. – howdytom Oct 19 '17 at 23:28
1

This issue sometimes occurs when the original files are too large, causing memory exhaustion on the server during thumbnail creation. Since the thumbnail creation on an image style cache flush is generated in a serial queue, just one high res image can prevent all the other image style thumbnails from being generated.

Steps to check and attempt to resolve this include:

  1. After immediately trying to reset/flush the image style cache, check your apache and php logs on the server itself (as the memory exhaustion errors don't typically appear in the Drupal watchdog logs).
  2. If you in fact encounter the memory exhaustion error, try increasing the server's memory limit. See https://stackoverflow.com/questions/3534274/php-memory-exhausted
  3. If after bumping the memory limit you continue to encounter this error, spot check some of the original images- determine the actual pixel dimensions of each image as well as the pixel density and/or dpi. If either is significantly large, you may want to download the original images, batch process/resave at a more reasonable size, and upload back to the server; then trigger the image style flush/thumbnail regeneration again.
  4. If #3 resolves the issue, you may want to apply max width/height to the image upload field config itself to prevent content managers from uploading enormous images in the future too. Note: Depending on your settings, this approach may result in saving a downsized version of the original image, if the original image exceeds maximum dimensions; or result in a warning to the content manager prompting them to upload a smaller image.

  5. In conjunction with the max width & height options, you may also want to change the jpeg quality of the images generated for the image styles. While signed in as an admin, go to Configuration > Media > Image Toolkit (/admin/config/media/image-toolkit)

jpeg quality setting

  • Thank you for your reply. The memory_limit is to 1024MB, whioch should be totally ok. I'll take a closer look at this. Your answer was really helpful. – howdytom Nov 4 '17 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.