Question : imagejpeg doesn't work?

I have a situation where I'm doing some image manipulation. I want to save the created image to a file & then display it in the browser.

Two files attached, the first, called merge_test, creates the image & displays it directly in the browser. It works.

The 2nd called merge_test_save attempts to SAVE the file first, then display it in HTML. The 2nd DOES NOT work.

The file IS NOT saved in the location indicated.

What's wrong?
Attachments:
 
merge_test
 
 
merge_test_save
 

Answer : imagejpeg doesn't work?

Yes, it saves it and displays it in the <img> tag afterwards.  If you take the code I posted above and put your own fixed images in there, you can see that it works.  Then uncomment line 101 and comment line 102.  That's when it stops working for me.

One other thing to look at is $pfile = "http://www.motorvatorads.com/staging/temp_images/" . $rowph[2];  I don't think you can do a 'write' that way because you can't get 'PUT' privileges on the web server with a full URL like that.  If you can use a 'relative' url and write the file in the directory the script is in, that might work.  $pfile = "staging/temp_images/" . $rowph[2]; might also work since it doesn't have the 'http' in front of it.  'http' makes it a different 'method'.

"<? (short open tag)"  is fine as long as it is working for you.  I have several sites that I maintain that are written that way.  But now you know if you change servers and your PHP stops working.  "<? (short open tag)" is not compatible with the XML tag because it starts off the same: <? xml".  That was the reason for the change.
Random Solutions  
 
programming4us programming4us