bastband Posted July 6, 2007 Share Posted July 6, 2007 Hi All, Hope someone can help, you probably have been asked this before.... How can I save a show.php file as a .jpg or similar? Many thanks Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted July 6, 2007 Share Posted July 6, 2007 header("Content-type: image/jpeg"); Quote Link to comment Share on other sites More sharing options...
bastband Posted July 6, 2007 Author Share Posted July 6, 2007 Complete php virgin here, what do I do with the reply? Is there not a conversion program please... Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted July 6, 2007 Share Posted July 6, 2007 Well, I don't quite know what you mean with saving show.php as a JPEG. Do you want show.php to output a picture (a JPEG)? Try this: <?php // do some stuff here to determine the path of the image on the server - for this example we'll just set it like this: $img_path = "/home/somebody/images/test.jpg"; // note that this is outside the document root in this example header("Content-type: image/jpeg"); // here we tell the browser that it is a jpeg @readfile($img_path); // here we read the contents of the file and output it die(); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.