Imagekit Plugin - Can't create thumbnails

I’m trying improve page load times and am trying out Imagekit but I keep getting the error:

Thumbnail creation for “content/3-project/3-project-5/20170925_numero_shot_02_0039_f1.jpg” failed. Please ensure, that the thumbs directory is writable and your driver configuration is correct.

I’ve increased the memory limit in the config but how else can I troubleshoot the directory and driver configuration? Any help would very much be appreciated.

ini_set('memory_limit', '256M');

Are thumbnails created if the plugin is disabled? If yes, the thumbs folder is writable and there should not be a problem with the driver configuration.

Have you tried to generate the thumbs through the Panel widget?

BTW: If a problem is solved, please return here to let us know or set the category to solved. Thank you.

Thanks for the swift response, sorry for the silly question but how can I determine if they are created?

Yes, I get the error when I try to generate the thumbnails through the widget.

Well, if your thumbs folder fills up with thumbs, they are created. Is your page very image heavy and are you creating many thumbnail sizes? Does this error always appear with the same image name if you repeatedly click on thumbnail generation or reload the page?

Thanks for the help. I think the thumbs folded is writable as clicked the ‘clear’ button and the thumbnails created counter has slowly gone up to 30 where it seems to have stalled. Yes, it’s quite image heavy, I have about 60 images on one page. Yes, it always the same image name even after refreshing.

Hm, is that particular file very big? Maybe you have to increase the memory_limit even more, if possible and I’d do that in php.ini. Is that on localhost or on a remote server? If this is on a remote server, find out what the maximum memory_limit is.

@fabianmichael Am I right to assume that the error message is misleading in. this case? I remember that I once ran into the same issue but think the problem was rather related to memory settings but can’t remember. Any ideas?

Also, what is your script run time? However, it is strange that is always stops at the same image.

This error message is thrown whenever thumbnail creation has failed. ImageKit checks for the existance of the target file and also tries to throw an error, if PHP runs out of memory. You should always clean the thumb directory before moving to a new server or moving the site to a different folder, as the current version of ImageKit stores absolute paths in the job files (= the place, where it checks whether a HTTP request to a queued thumbnail is valid and what settings do apply for thumbnail creation).

That particular file is 3MB at 3248 × 2126px. I put the memory limit of php.ini to memory_limit = 999Mand in my config.php I have done the sameini_set('memory_limit', '999M');. I pushed the site to a staging server and I’m getting the same error. How do I find out what my script run time is?

Ok file size shouldn’t be an issue then. Check your php.ini or via phpinfo()what the max_execution_time value is set to. You usually can’t increase this value beyond the limits allowed by your hosting provider (if you are on shared hosting).

Also, if you are on shared hosting and increase the memory_limit to a value not supported by the hosting service, it won’t have any effect, of course. If in doubt, contact your hosting provider.

Are you using the imagemagick (IM) thumbs driver or the GD library? If you can, switch to IM.

2 Likes

Thank so much @texnixe for the help. It’s now working, in the php.ini I added the lines max_execution_time = 90 and memory_limit = 999M (which I will now lower), I was using a VPS on Digital Ocean. I also changed the thumbs drive to ImageMagick c::set('thumbs.driver', 'im'); in my config.