Image field: thumbnailing via phpThumb fails because of image path not under document root

More
10 years 2 weeks ago - 9 years 10 months ago #59784 by tonnick
Hello
I get an error from phpThumb that thumbnailing fails because
- the given image source path is not under the detected DOCUMENT Root of the web-server

Joomla 3.4.8
FLEXIcontent v3.0.8
Code:
Failed2: phpThumb() v1.7.13-201406261000 http://phpthumb.sourceforge.net Error messages disabled. edit phpThumb.config.php and (temporarily) set $PHPTHUMB_CONFIG['disable_debug'] = false; to view the details of this error phpThumb() v1.7.13-201406261000 in file "phpthumb.class.php" on line 225 setSourceFilename(/dev.origin-gi.com/httpdocs/images/news/invitationwashington2015_th.jpg) set $this->sourceFilename to "/dev.origin-gi.com/httpdocs/images/news/invitationwashington2015_th.jpg" in file "phpthumb.class.php" on line 276 $AvailableImageOutputFormats = array(text;ico;bmp;wbmp;gif;png;jpeg) in file "phpthumb.class.php" on line 930 $this->thumbnailFormat set to $this->config_output_format "jpeg" in file "phpthumb.class.php" on line 941 $this->thumbnailQuality set to "90" in file "phpthumb.class.php" on line 958 resolvePath: /dev.origin-gi.com/httpdocs/images/news/invitationwashington2015_th.jpg (allowed_dirs: Array ( ) ) in file "phpthumb.class.php" on line 1101 resolvePath: iteration, path=/dev.origin-gi.com/httpdocs/images/news/invitationwashington2015_th.jpg, base path = /data/www/origin/dev.origin-gi.com/httpdocs in file "phpthumb.class.php" on line 1120 open_basedir: "" in file "phpthumb.class.php" on line 1087 resolvePath: stop at component 6 in file "phpthumb.class.php" on line 1136 resolvePath: stop at path=/dev.origin-gi.com/httpdocs/images/news/invitationwashington2015_th.jpg in file "phpthumb.class.php" on line 1139 resolvePath: no match, returning null in file "phpthumb.class.php" on line 1141 !$this->config_allow_src_above_docroot therefore setting "" (outside "/data/www/origin/dev.origin-gi.com/httpdocs") to null in file "phpthumb.class.php" on line 1266 $this->sourceFilename set to "" in file "phpthumb.class.php" on line 854 phpThumb() v1.7.13-201406261000 http://phpthumb.sourceforge.net Error messages disabled. edit phpThumb.config.php and (temporarily) set $PHPTHUMB_CONFIG['disable_debug'] = false; to view the details of this error in file "phpthumb.class.php" on line 4055 setCacheDirectory() starting with config_cache_directory = "" in file "phpthumb.class.php" on line 966 $this->config_cache_directory () is not a directory in file "phpthumb.class.php" on line 1002 SetCacheFilename() failed because $this->config_cache_directory is empty in file "phpthumb.class.php" on line 3409 starting ExtractEXIFgetImageSize() in file "phpthumb.class.php" on line 3241 skipping GetImageSize() because $this->sourceFilename is empty in file "phpthumb.class.php" on line 3253 GetImageSize("") failed in file "phpthumb.class.php" on line 3284 $this->useRawIMoutput=true after checking $UnAllowedParameters in file "phpthumb.class.php" on line 1513 ImageMagickThumbnailToGD() aborting because $this->sourceFilename is empty in file "phpthumb.class.php" on line 1557 ImageMagickThumbnailToGD() failed in file "phpthumb.class.php" on line 3291 SetOrientationDependantWidthHeight() starting with ""x"" in file "phpthumb.class.php" on line 3220 SetOrientationDependantWidthHeight() setting w="800", h="600" in file "phpthumb.class.php" on line 3236 exif_thumbnail() does not exist, cannot extract EXIF thumbnail in file "phpthumb.class.php" on line 3344 EXIF thumbnail extraction: (size=0; type=""; 0x0) in file "phpthumb.class.php" on line 3348 starting SourceImageToGD() in file "phpthumb.class.php" on line 3608 Not using EXIF thumbnail data because $this->exif_thumbnail_data is empty in file "phpthumb.class.php" on line 3679 $this->gdimg_source is still empty in file "phpthumb.class.php" on line 3731 ImageMagickThumbnailToGD() failed in file "phpthumb.class.php" on line 3733 phpThumb() v1.7.13-201406261000 http://phpthumb.sourceforge.net Error messages disabled. edit phpThumb.config.php and (temporarily) set $PHPTHUMB_CONFIG['disable_debug'] = false; to view the details of this error in file "phpthumb.class.php" on line 4055 SourceImageToGD() failed in file "phpthumb.class.php" on line 356
Last edit: 9 years 10 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
9 years 11 months ago - 9 years 10 months ago #60482 by ggppdk
Hello

- image field does not work in ANY mode, will not work in any mode

how did you configure the base folder for the website ?

This path is wrong detected:
/DOMAIN/httpdocs/

but correct seems to be ?:
/data/www/origin/DOMAIN/httpdocs


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!
Last edit: 9 years 10 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
9 years 11 months ago - 9 years 10 months ago #60491 by tonnick
this is chrooted environment so, it depends how do you consider base folder.

full path is /data/www/origin/DOMAIN/httpdocs that's correct
And from chrooted point of view, it is /DOMAIN/httpdocs/
Last edit: 9 years 10 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
9 years 11 months ago - 9 years 10 months ago #60505 by ggppdk
Hello

i will add loading of PhpThumb configuration file into the image field

then you can try setting the SERVER document root manually

edit:
components/com_flexicontent/librairies/phpthumb/phpThumb.config.php

find line (about 40) , put it in comments with //
Code:
$PHPTHUMB_CONFIG['document_root'] = ...


Then try to set the path to:
Code:
$PHPTHUMB_CONFIG['document_root'] = '/DOMAIN/httpdocs';
or to:
Code:
$PHPTHUMB_CONFIG['document_root'] = '/data/www/origin/DOMAIN/httpdocs';

as a last workaround set to true this: (aka allow) access to images outside the document root
Code:
$PHPTHUMB_CONFIG['allow_src_above_docroot'] = false; // if false (default) only allow src within document_root; if true, allow src to be anywhere in filesystem


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!
Last edit: 9 years 10 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
9 years 10 months ago #60810 by ggppdk
Hello

please download (redownload if you have downloaded already) v3.0.14-rc2a

install and 1st try to set the document root as described above and then if it does not work , then finally enable the parameter to allow images outside web server's document root


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
9 years 10 months ago #60825 by tonnick
no luck , but it seems that whatever the value I put in $PHPTHUMB_CONFIG = ..., it seems overwritten by phpthumb.class.php

"phpthumb.class.php" on line 1146

resolvePath: iteration, path=/DOMAIN/httpdocs/images/news/./invitationwashington2015_th.jpg, base path = /data/www/CHROOT/DOMAIN/httpdocs in file "phpthumb.class.php" on line 1165

So it never change, issue always remainns

Please Log in or Create an account to join the conversation.

More
9 years 10 months ago #60834 by ggppdk
Hello

no luck , but it seems that whatever the value I put in $PHPTHUMB_CONFIG = ..., it seems overwritten by phpthumb.class.php


overwrites configuration ?
- maybe the load order of the PHP files needs to be reversed in the image field

load class file and then load configuration

or load configuration after instantiating the phpThumb object

i will need to retest and make sure that they are indeed applied


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
9 years 10 months ago #60848 by tonnick
ok no pb. you can use the credentials I sent you as it is a dev website if you want to test it.

Please Log in or Create an account to join the conversation.

More
9 years 10 months ago #60856 by ggppdk
Hello

please note

that FLEXIcontent incudes an updated phpThumb version with no known security issues,
- like creating a PHP file or injecting code inside PHP files

but

if you allow "access to above document root" someone may still image thumbnails like your site statistics or other images outside document root
- so you you should avoid setting this to true
$PHPTHUMB_CONFIG = false; // if false (default) only allow src within

and instead set document root appropriately, (i will verify that this phpThumb config is loaded properly by image field)
- still if you can find why the web-server document root is not detected properly in your server that would be even better

e.g. image field in folder mode protects original images with .htaccess ! (can be disabled)
- thus only only already thumbnailed images can be re-thumbnailed !!
- which already thumbnailed images can already have a watermark (if this was enabled)


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
9 years 10 months ago #61017 by tonnick
I already tried to modufy all thoses parameters as you recommandes, without any luck.

So, did you release a new version which would work ?

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save