Image upload (and thumbnail generation) leads to 500 error on frontend

Permalink
Hi There,

I am using Concrete 5.8.2 and the new Image Thumbnail System for a custom gallery. For the gallery, I added one thumbnail type for the gallery list and 3 Thumbnail Types for the gallery overlay (small, medium, large).

Together with the retina (double) Version for every thumbnail Type and the File Manager Thumbnail Types, the system needs to generate 11 Thumbnail upon upload of every Image

That works so far, the thumbnails get generated on upload. The problem is, that during the image upload, the website frontend responds with a timeout / 500 error because all memory seems to be needed for the image generation.

Has anybody experienced the same behaviour?

Is it possible to disable retina thumbnail generation, which now happens automatically for every thumbnail type, I create?

Best Regards
Jan

janwidmer
View Replies:
Remo replied on at Permalink Reply
Remo
Not the same, but similar. We've had issues with the thumbnail types whenever we wanted to rescan the file. Due to some other bug we had to rescan every picture in the file manager. Selecting multiple files is obviously quite nice, but that didn't work.

This line tells concrete5 to handle 5 files in one request:https://github.com/concrete5/concrete5/blob/develop/concrete/control...

Even for a pretty powerful server, that was too much. We had to reduce this to 1 to be able to rescan all our files.

The reason for this was the same, the thumbnail types. In our case 16 thumbnails per picture. Restricting the maximum size in this screen helped: /dashboard/system/files/image_uploading

We haven't found a way to disable the retina thumbnails without hacking the core, but even that wouldn't have been enough for us. We were looking into a more sophisticated solution that would allow us to specify thumbnail types per folder. That way we could create the 150x150 thumbnail for the team only and create a 1200x900 thumbnail for gallery pictures. We're a bit puzzled how the current system isn't bothering more users.

In our opinion it's pretty essential to be able to do this:
* Specify thumbnail types per folder
* Disable retina thumbnail types

Implementing this isn't that easy, for now we're using a solution outside of the concrete5 core.
janwidmer replied on at Permalink Reply
janwidmer
Hey Remo,

Thanks for your inputs. That were exactly my thoughts, how are not more people having those problems when building responsive websites.. Specifing a folder per Thumbnail / rendition is such a basic requirement when working with a lot of different renditions.

I extended the core Image / Picture classes in a way, that I can at least have multiple thumbnail Bundles defined in my Theme and provide a bundleId when creating a new picture tag:

// Page Theme
public function getThemeResponsiveImageMap()
   {
      return array(
         'default' => array(
            'w3k_large' => '768px',
            'w3k_medium' => '480px',
            'w3k_small' => '0px',
         ),
         'content' => array(
            'w3k_large' => '768px',
            'w3k_medium' => '480px',
            'w3k_small' => '0px',
         )
      );


// Picture Class
public function __construct(File $f = null, $bundleId = 'default', $usePictureTag = null)
{
   // ...
  foreach ($this->theme->getThemeResponsiveImageMap()[$bundleId] as $thumbnail => $width) {
       // ...
   }
   // ...
}


Of course, that doesn't solve the problem of too many thumbnails being generated, but at least I can use the picture tag.

And the Retina generation for just all images is quite bad, since I only need it for just one rendition and would prefer it to add a retina rendition myself..

Have you thought about creating a bug on c5 github? The "problem" why I haven't created one is, that technically it's not a bug, but just not an ideal way of how it is done..

Just out of curiousity, which external solution did you choose for the image handling? I have used this one (http://phpthumb.sourceforge.net/) in other cms, but I guess, it's not so easy to integrate it to c5 in an easy way for the user..

Thanks and best regards
Jan
Remo replied on at Permalink Reply
Remo
Don't ask me where to post such requests, I feel like every place is wrong ;-)

We are currently using the basic thumbnailer a bit more getThumbnail(.., $width, $height) and there's one project where I've integrated imbo (https://github.com/imbo/imbo), but that project doesn't have much concrete5 stuff in it anymore.
janwidmer replied on at Permalink Reply
janwidmer
yeah I had the same feelings.. but when we just post it here in the forums, the right people will probably not see it.

I will create an issue and post the link here.
MrKDilkington replied on at Permalink Reply
MrKDilkington
@janwidmer
@Remo

I agree that there should be a config value for controlling retina thumbnail creation (with retina thumbnails disabled by default). I have a feeling that they are rarely used, while at the same time requiring server resources to process and disk space to store.

Creating thumbnails based on images in a specific folder would also be very useful. It would prevent the creation of many unused thumbnails.

There are two open GitHub issues related to this discussion.

"Conditional thumbnails #3559"
https://github.com/concrete5/concrete5/issues/3559...

"Be able to toggle creation of retina thumbnails #2633"
https://github.com/concrete5/concrete5/issues/2633...

Please leave a comment and thumbsup for these issues to show your interest.
Remo replied on at Permalink Reply
Remo
Thanks Karl! I've missed those issues.
Remo replied on at Permalink Reply
Remo
this should take care of the retina thumbnail typeshttps://github.com/concrete5/concrete5/issues/2633...
janwidmer replied on at Permalink Reply
janwidmer
Thanks Karl, I missed them two.. :-D I will give them a thumbs up