<![CDATA[ Gallery phpThumbOf Could not generate thumbnail - MODX Community Forums]]> https://forums.modx.com/thread/?thread=87742 <![CDATA[Re: Gallery phpThumbOf Could not generate thumbnail]]> https://forums.modx.com/thread/87742/gallery-phpthumbof-could-not-generate-thumbnail?page=2#dis-post-527190
My problem was associated with the modx installation being put into a sub folder (base path: /usr/www/users/userX/projects/modx/ and base url: /projects/modx/). I'm running modx 2.3.3 and gallery 1.7.0.

I found the problem in this file: /projects/modx/core/components/gallery/processors/web/phpthumb.php on line 69

$src = str_replace(basename($basePath), '', $src);

I found that if the website is in a sub folder the basename function only removes the last folder from the path rather than two or more which then also leaves two slashes and in my case part of the base url.

So a thumbnail request like for the image /projects/modx/assets/gallery/1/image.jpg:


The processor then transforms the input source to:

I replaced the above piece of code with the following:

$baseUrl = $modx->getOption('base_url', null, MODX_BASE_URL);
$src = str_replace($baseUrl, '', $src);

This then caused the processor to strip more than one folder from the path including the slash "/".

The resulting input source would them become:

Which is correct.

I'm not sure if the code should be replaced in the gallery project's processor to perhaps to resolve future problems, because even if project is located in /projects/modx/projectA/modxWebsite/ then the base url will be /projects/modx/projectA/modxWebsite/ and it will remove it appropriately.

Hope this helps.]]>
EvoBunny Jun 20, 2015, 07:53 AM https://forums.modx.com/thread/87742/gallery-phpthumbof-could-not-generate-thumbnail?page=2#dis-post-527190
<![CDATA[Re: Gallery phpThumbOf Could not generate thumbnail]]> https://forums.modx.com/thread/87742/gallery-phpthumbof-could-not-generate-thumbnail?page=2#dis-post-524930
No ImageMagick installed!

  • Make sure that the "assets/components/phpthumbof/cache" directory is created and is writable by PHP
  • Make sure you have ImageMagick installed and enabled on your PHP installation
  • If your host is using symlinks for its directory structure, make sure they point to the correct, true path in core/config/config.inc.php
avenus Apr 27, 2015, 04:10 PM https://forums.modx.com/thread/87742/gallery-phpthumbof-could-not-generate-thumbnail?page=2#dis-post-524930
<![CDATA[Re: Gallery phpThumbOf Could not generate thumbnail]]> https://forums.modx.com/thread/87742/gallery-phpthumbof-could-not-generate-thumbnail?page=2#dis-post-487768 chrisandy Jan 20, 2014, 03:50 AM https://forums.modx.com/thread/87742/gallery-phpthumbof-could-not-generate-thumbnail?page=2#dis-post-487768 <![CDATA[Re: Gallery phpThumbOf Could not generate thumbnail]]> https://forums.modx.com/thread/87742/gallery-phpthumbof-could-not-generate-thumbnail#dis-post-487767 Quote from: chrisandy at Jan 20, 2014, 09:07 AM
I'm on the move right now so can't check but I think there is also a setting that allows thumbs to be created above the web root?

Thanks for suggesting to play with settings.

I changed "gallery.thumbs_prepend_site_url"'s value to "yes" and it worked (although I don't understand why yet) !]]>
arnaud73 Jan 20, 2014, 03:43 AM https://forums.modx.com/thread/87742/gallery-phpthumbof-could-not-generate-thumbnail#dis-post-487767
<![CDATA[Re: Gallery phpThumbOf Could not generate thumbnail]]> https://forums.modx.com/thread/87742/gallery-phpthumbof-could-not-generate-thumbnail#dis-post-487765 chrisandy Jan 20, 2014, 03:07 AM https://forums.modx.com/thread/87742/gallery-phpthumbof-could-not-generate-thumbnail#dis-post-487765 <![CDATA[Re: Gallery phpThumbOf Could not generate thumbnail]]> https://forums.modx.com/thread/87742/gallery-phpthumbof-could-not-generate-thumbnail#dis-post-487763 Quote from: sottwell at Jan 20, 2014, 03:51 AM
You need to go into the System Settings, and change the Use Friendly URLs setting to Yes. Use the Filter by Area drop-down and select the Friendly URL area.

Thanks, it worked at least for the URLs (BTW, this manipulation might be integrated within the MODx installation procedure).

However, this did not changed anything regarding the thumbnail generation. I still get the same error.]]>
arnaud73 Jan 20, 2014, 02:29 AM https://forums.modx.com/thread/87742/gallery-phpthumbof-could-not-generate-thumbnail#dis-post-487763
<![CDATA[Re: Gallery phpThumbOf Could not generate thumbnail]]> https://forums.modx.com/thread/87742/gallery-phpthumbof-could-not-generate-thumbnail#dis-post-487748 sottwell Jan 19, 2014, 09:51 PM https://forums.modx.com/thread/87742/gallery-phpthumbof-could-not-generate-thumbnail#dis-post-487748 <![CDATA[Re: Gallery phpThumbOf Could not generate thumbnail]]> https://forums.modx.com/thread/87742/gallery-phpthumbof-could-not-generate-thumbnail#dis-post-487737 Quote from: chrisandy at Jan 19, 2014, 07:59 PM
You got Furls on?

I guess you mean Friendly URLs. I activated those by renaming the "ht.access" file, but I did not notice any change in the way Gallery is working nor the way MODx manages URLs (I just discovered MODx 3 days ago).]]>
arnaud73 Jan 19, 2014, 03:22 PM https://forums.modx.com/thread/87742/gallery-phpthumbof-could-not-generate-thumbnail#dis-post-487737
<![CDATA[Re: Gallery phpThumbOf Could not generate thumbnail]]> https://forums.modx.com/thread/87742/gallery-phpthumbof-could-not-generate-thumbnail#dis-post-487735
You got Furls on?]]>
chrisandy Jan 19, 2014, 01:59 PM https://forums.modx.com/thread/87742/gallery-phpthumbof-could-not-generate-thumbnail#dis-post-487735
<![CDATA[Re: Gallery phpThumbOf Could not generate thumbnail]]> https://forums.modx.com/thread/87742/gallery-phpthumbof-could-not-generate-thumbnail#dis-post-487733 Quote from: chrisandy at Jan 19, 2014, 07:13 PM
Any help (delete this post if I've misunderstood):


Interesting. The description of the issue indicates it is the same kind of problem, however, the fix was for PHPThumbOf add-on. In the current case, the problem is within PHPThumb which is part of the core.]]>
arnaud73 Jan 19, 2014, 01:48 PM https://forums.modx.com/thread/87742/gallery-phpthumbof-could-not-generate-thumbnail#dis-post-487733