auxilium Posted October 1, 2009 Share Posted October 1, 2009 After working on this for a while, I realized I couldn't save the output image, although the image displays in the browser perfectly fine. When I try to open the file in windows it says the format of the file can't be determined, and checking the properties in my browser, I notice the file is only 68 bytes. I trimmed my code slowly to try and figure out where the problem was, until I got all the way back to the start, and it still gives me the same problem. Am I missing something in the basic steps to create an image? <?php $image=imagecreatefromjpeg('test.jpg'); header('Content-type: image/jpeg'); imagejpeg($image); imagedestroy($image); ?> Link to comment https://forums.phpfreaks.com/topic/176181-solved-imagecreatefromjpeg-cant-save-images/ Share on other sites More sharing options...
PFMaBiSmAd Posted October 1, 2009 Share Posted October 1, 2009 couldn't save the output image Couldn't save it where and how, exactly? Link to comment https://forums.phpfreaks.com/topic/176181-solved-imagecreatefromjpeg-cant-save-images/#findComment-928435 Share on other sites More sharing options...
auxilium Posted October 1, 2009 Author Share Posted October 1, 2009 What I meant was actually save the image as a file on my hard drive. I assumed since I could visibly see the image, I'd be able to simply "save image as..." on to my hard drive. Link to comment https://forums.phpfreaks.com/topic/176181-solved-imagecreatefromjpeg-cant-save-images/#findComment-928456 Share on other sites More sharing options...
PFMaBiSmAd Posted October 1, 2009 Share Posted October 1, 2009 When you open the saved file using a programing editor, what exactly is in it? How are you browsing to this file or what does the link look like in your html? What you are doing works, so it must be something specific to what or how you are doing it. Link to comment https://forums.phpfreaks.com/topic/176181-solved-imagecreatefromjpeg-cant-save-images/#findComment-928458 Share on other sites More sharing options...
auxilium Posted October 1, 2009 Author Share Posted October 1, 2009 How are you browsing to this file or what does the link look like in your html? This clued me in to my problem. Originally, I was having a problem with the headers, and while trying to figure that out, the php code ended up outside of any html on the page the image gets displayed on (which is a redirect from a first page, which is also why I was having the header problem). Anyway, that made me figure out what my problem was, thanks! Link to comment https://forums.phpfreaks.com/topic/176181-solved-imagecreatefromjpeg-cant-save-images/#findComment-928482 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.