Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative path problem when using phpThumb #4

Closed
oo12 opened this issue Nov 5, 2013 · 7 comments
Closed

Relative path problem when using phpThumb #4

oo12 opened this issue Nov 5, 2013 · 7 comments

Comments

@oo12
Copy link
Collaborator

oo12 commented Nov 5, 2013

When using phpThumb, if you give pThumb a relative path and your $_SERVER['DOCUMENT_ROOT'] is different than MODX_BASE_PATH, the file won't be found. Resizer works ok.

oo12 added a commit that referenced this issue Nov 5, 2013
@ghost
Copy link

ghost commented Nov 5, 2013

Fixed the path issue. But it cant generate a thumbnail. Here is the errror log. Ill check on this later today and get back with more info. Just gotta complete a project first.

As a ref, i checked phpthumbsup as well. It had the same issue with the paths. So i guess we could recommend the developer of that project to sort the same issue.

[2013-11-05 07:32:10](ERROR @ /index.php) [pThumb] Resource: 1 || Image: assets/product_photo_lasse.png
Could not generate thumbnail
phpThumb debug output:
[0] => phpThumb() v1.7.9-200712090829 in file "phpthumb.class.php" on line 216
[1] => setSourceFilename(/Users/williamastrom/Development/test.dev/public/assets/product_photo_lasse.png) set $this->sourceFilename to "/Users/williamastrom/Development/test.dev/public/assets/product_photo_lasse.png" in file "phpthumb.class.php" on line 243
[2] => file_exists() = 0 in file "phpthumb.class.php" on line 1101
[3] => is_executable() = 0 in file "phpthumb.class.php" on line 1102
[4] => ImageMagickThumbnailToGD() aborting because cannot find convert in $this->config_imagemagick_path (), and which convert returned () in file "phpthumb.class.php" on line 1131
[5] => $AvailableImageOutputFormats = array(text;ico;bmp;wbmp;gif;png;jpeg) in file "phpthumb.class.php" on line 884
[6] => $this->thumbnailFormat set to $this->config_output_format "jpeg" in file "phpthumb.class.php" on line 895
[7] => $this->thumbnailFormat set to $this->f "png" in file "phpthumb.class.php" on line 902
[8] => $this->thumbnailQuality set to "75" in file "phpthumb.class.php" on line 912
[9] => !$this->config_allow_src_above_docroot therefore setting "/Users/williamastrom/Development/test.dev/public/assets/product_photo_lasse.png" (outside "/Library/WebServer/Documents") to null in file "phpthumb.class.php" on line 1066
[10] => $this->sourceFilename set to "" in file "phpthumb.class.php" on line 813
[11] => phpThumb() v1.7.9-200712090829

"" does not exist in file "phpthumb.class.php" on line 3647
[12] => setCacheDirectory() starting with config_cache_directory = "" in file "phpthumb.class.php" on line 919
[13] => $this->config_cache_directory () is not a directory in file "phpthumb.class.php" on line 955
[14] => SetCacheFilename() failed because $this->config_cache_directory is empty in file "phpthumb.class.php" on line 3040
[15] => starting ExtractEXIFgetImageSize() in file "phpthumb.class.php" on line 2897
[16] => GetImageSize("") failed in file "phpthumb.class.php" on line 2920
[17] => $this->useRawIMoutput=true after checking $UnAllowedParameters in file "phpthumb.class.php" on line 1232
[18] => ImageMagickThumbnailToGD() aborting because $this->sourceFilename is empty in file "phpthumb.class.php" on line 1279
[19] => ImageMagickThumbnailToGD() failed in file "phpthumb.class.php" on line 2927
[20] => SetOrientationDependantWidthHeight() starting with ""x"" in file "phpthumb.class.php" on line 2876
[21] => SetOrientationDependantWidthHeight() setting w="100", h="400" in file "phpthumb.class.php" on line 2892
[22] => EXIF thumbnail extraction: (size=0; type=""; 0x0) in file "phpthumb.class.php" on line 2979
[23] => starting SourceImageToGD() in file "phpthumb.class.php" on line 3229
[24] => $this->useRawIMoutput=true after checking $UnAllowedParameters in file "phpthumb.class.php" on line 1232
[25] => ImageMagickThumbnailToGD() aborting because $this->sourceFilename is empty in file "phpthumb.class.php" on line 1279
[26] => Not using EXIF thumbnail data because $this->exif_thumbnail_data is empty in file "phpthumb.class.php" on line 3278
[27] => $this->gdimg_source is still empty in file "phpthumb.class.php" on line 3330
[28] => ImageMagickThumbnailToGD() failed in file "phpthumb.class.php" on line 3332
[29] => phpThumb() v1.7.9-200712090829

Unknown image type identified by "" () in SourceImageToGD()[3444] in file "phpthumb.class.php" on line 3647
[30] => SourceImageToGD() failed in file "phpthumb.class.php" on line 323

@oo12
Copy link
Collaborator Author

oo12 commented Nov 5, 2013

This is the problem right here:

[9] => !$this->config_allow_src_above_docroot therefore setting
"/Users/williamastrom/Development/test.dev/public/assets/product_photo_lasse.png" (outside
"/Library/WebServer/Documents") to null in file "phpthumb.class.php" on line 1066

Since MODX is installed outside of what your web server thinks is your document root, phpThumb isn't happy. It has a couple settings I can use to fix that I think, but this misconfiguration might cause problems for you elsewhere too.

Since you're on a Mac, there's a nice program called MAMP, which installs Apache, PHP and MySQL. It's dead simple to install and configure; much easier than OS X's built-in web server. All you need is the free version. I just tested it on my computer and it sets the document root properly for PHP. You might give that a try if you've got a few minutes...

I'll see tonight what I can do about phpThumb and your current configuration though.

oo12 added a commit that referenced this issue Nov 6, 2013
@oo12
Copy link
Collaborator Author

oo12 commented Nov 6, 2013

One more version for you to try if you don't mind.

phpThumb will probably find something new to complain about though :-) You can see it's rather paranoid about checking everything each time it creates an image!

@oo12
Copy link
Collaborator Author

oo12 commented Nov 11, 2013

I put these changes into v2.2.0. If you still have your machine set up like that, give it a try if you like.

@ghost
Copy link

ghost commented Nov 13, 2013

Sorry for being non-responsive. Was covered in work. I will have a look at this today, or tomorrow the lastest and get back to you. And yes, i have left my mac that way to be able to test this so ill check on it!

@oo12
Copy link
Collaborator Author

oo12 commented Nov 14, 2013

Ok, whenever you get the chance... Thanks!
I made a few other related changes in 2.2. pThumb will now use the phpthumb_allow_src_above_docroot phpthumb_document_root system settings (in core > phpThumb). If there's nothing in phpthumb_document_root then it sets it to MODX_BASE_PATH.

@oo12
Copy link
Collaborator Author

oo12 commented Dec 6, 2013

I'm going to close this, but please reopen if it continues to be a problem.

@oo12 oo12 closed this as completed Dec 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant