thumbnail creation: unable to open ... for writing ...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
potato
Forum Contributor
Posts: 192
Joined: Tue Mar 16, 2004 8:30 am
Location: my lovely trailer, next to the big tree

thumbnail creation: unable to open ... for writing ...

Post by potato »

Hey,

im stucked for more than 6 hours! searching for a way to make some thumbnails of a uploaded image.
i tested 6 different thumnail classes from phpclasses.org, but i always get the same error like this one:

Warning: imagejpeg() [function.imagejpeg]: Unable to open 'http://www.tuning-matrix.net/uploads/728803_596529.jpg' for writing in /home/tunixnet/public_html/core/functions/thumbnail/tnimg.lib.php on line 412

the tmp image and the folder where its in are chmod 777, so that not it.
I have checked in phpinfo that my gd is enabled, actualy all the options are enabled.
i'm using version: bundled (2.0.28 compatible)

somebody knows what it could be?

Thanx
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

try touch()ing the file first - it seems to work!
User avatar
potato
Forum Contributor
Posts: 192
Joined: Tue Mar 16, 2004 8:30 am
Location: my lovely trailer, next to the big tree

Post by potato »

now i get this error:

Warning: touch() [function.touch]: Unable to create file http://www.tuning-matrix.net/uploads/728803_596531.jpg because No such file or directory in /home/tunixnet/public_html/core/functions/upload/uu_finished.php on line 204

but the image is there, chmodded 777, i think its a server issue
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

wait a second... are you trying to touch/write to the file with the http:// prefix? You can't do that.. you need to access it as a local file.

Instead, try:

Code: Select all

touch('/home/tunixnet/public_html/uploads/728803_596531.jpg');
User avatar
potato
Forum Contributor
Posts: 192
Joined: Tue Mar 16, 2004 8:30 am
Location: my lovely trailer, next to the big tree

Post by potato »

jaaaaaaaa! :D THANKYOU!!

i had:

touch($path_to_upload.$uploaded_file_name);

but the strangest is that the url is correct, even when its not harcoded.
now i changed it to:

touch('/home/tunixnet/public_html/uploads/'.$uploaded_file_name.'');

again, the 2 urls are the same, but one works, another not, very strange.:?

You have an explanation for this?
Post Reply