|
Posted by Rik on 12/18/56 11:48
Hello,
first of all, my provider sucks, newsserver is down for the #nth time
now, offcourse when I have an urgent question.... So this will be me
first time using Google Groups, forgive me if something goes wrong.
The problem at hand:
In a restricted area I let a user upload an image, no problem
The image gets scaled down with imagecopyresampled(), and stored with
imagejpeg($resized_img,'/path/to/target/image.jpg')
Problem is: because of safe_mode restrictions I cannot access it from
the server, only by http://domain.com/images/new_image.jpg.
I've tried:
imagejpeg($resized_img,'/path/to/target/image.jpg')
directly followed by:
chmod('/path/to/target/image.jpg',0777);
But the same script is also refused chmod().... It should be the same
user that creates the file, but unfortunately safe_mode won't let me
chmod() it.
I'm using referring to the image later on by the URL instead of the
/path/ as a temporary solution to make it work, but now the script
doesn't have any permission to unlink() the file at a later stage,
which is functionality I desperately need. How will I be able to
achieve this?
I thought bout using an FTP connection as a temporary measure, but no
go there:
24-05-06 17:50:55 SITE CHMOD 777 /path/to/image.jpg
24-05-06 17:50:55 550 /path/to/image.jpg: Operation not permitted.
The only solution I can think of right now is to catch imagejpg() in an
output buffer, don't use the filesystem but an ftp-connection to save
the file, and chmod it by ftp afterwards. An ugly solution, but the
only thing workable right now...
phpinfo():
open_basedir /home/user no value
safe_mode On On
safe_mode_exec_dir /usr/local/php/bin /usr/local/php/bin
safe_mode_gid Off Off
safe_mode_include_dir no value no value
Yes I have suggested moving to other hosting, no go there.. Changing
basic php.ini settings is unfortunately not an option.
Navigation:
[Reply to this message]
|