Forum

Thread tagged as: Question, Problem

Any way to regenerate thumbnails?

A client uploaded a bunch of images but told me non had thumbnails in the asset screen. I discovered it was because neither imagick or gd were installed when the server was switched to php7. I've now installed these libraries, but wish to retrospectively generate thumbnails for any images without them. Is this doable?

It might be worth mentioning that there are lots of images, uploaded pre php upgrade, that do have thumbnails.

I'm happy to look into creating an app or similar if u need to. Find assets without thumbnails and generate. How might I go about this?

Thanks!

Oliver Lowe

Oliver Lowe 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Are the images used in content regions?

They are being used in a perch_content_custom() field at the moment. There's no matching perch_content() region. I must have created the region with perch_content() then changed it. I did try the republish option but no dice.

Code currently looks like this:

    $banners = perch_content_custom('Banners', array(
        'skip-template' => true
    ), true);

Diagnostics:

Perch: 2.8.32, PHP: 7.0.8-0ubuntu0.16.04.3, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: 241ae00989d1995ffcbbf63d579943635faf9972 $, with PDO
Server OS: Linux, fpm-fcgi
Installed apps: content (2.8.32), assets (2.8.32), categories (2.8.32), perch_blog (5.0), ojl_events (1.0), perch_forms (1.8.3), ojl_talks (1.0), perch_mailchimp (3.0.1), perch_twitter (3.1)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_twitter', 'perch_forms', 'perch_mailchimp', 'ojl_talks', 'ojl_events', 'slkt_hidden_contact' );
PERCH_LOGINPATH: /system
PERCH_PATH: /var/www/slkt_live/htdocs/releases/20161113181301/public/system
PERCH_CORE: /var/www/slkt_live/htdocs/releases/20161113181301/public/system/core
PERCH_RESFILEPATH: /var/www/slkt_live/htdocs/releases/20161113181301/public/system/resources
Image manipulation: Imagick
PHP limits: Max upload 80M, Max POST 100M, Memory: 128M, Total max file upload: 80M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
SCRIPT_NAME: /system/core/settings/diagnostics/index.php
REQUEST_URI: /system/core/settings/diagnostics/
DOCUMENT_ROOT: /var/www/slkt_live/htdocs/current/public
HTTP_HOST: www.slkt.org.uk
Drew McLellan

Drew McLellan 2638 points
Perch Support

If using them in content isn't causing the thumbnail to be generated, then it may be the case that the thumbnail won't be regenerated unless the image is reuploaded.

Yes, it turns out this was the case. What is interesting is that it seems that Imagick wasn't creating thumbnails when installed alone. When I installed GD too then image thumbnails were created (on upload). Is this expected? Or should Imagick be creating thumbnails too?

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's not expected, unless you'd explicitly configured the site to use GD instead of Imagick.

Imagick actually creates more thumbnails than GD can - it will usually thumbnail PDFs and video too.

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's not expected, unless you'd explicitly configured the site to use GD instead of Imagick.

Imagick actually creates more thumbnails than GD can - it will usually thumbnail PDFs and video too.

Hmm, odd. I don't know if it's worth trying to debug that. I've got image thumbnails now that I've installed GD too. It's probably a quirk of my server configuration or something specific to my server.