Re: JPG Images from database to filename.jpg
| From: | Mike Gifford | Date: | Fri, 16 Nov 2001 17:50:09 +0000 |
| Subject: | Re: JPG Images from database to filename.jpg | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-74907@lists.php.net to get a copy of this message | ||
Sorry if I wasn't very clear abou tthis..
I don't need to echo the contents to be viewed on the web.. I'm already doing that here:
http://www.wtoaction.org/caravan2001/
It's a matter of saving it to a file on the disk (from the database) so I can manipulate it with djpeg, pnmscale, cjpeg
Thanks for throwing in the mysql stuff I left out..
Mike
Johan Holst Nielsen wrote:
Header("Content-type: image/jpeg"); echo $Images; I can't figure out how to create the header. There's lots of examples of how to do the above, but I have yet to stumble across an example which allows you to write the header into a file....You could make a PHP script that generate the picture? Like this: <?php /* Picture file need an ID!! */ $connection = mysql_connect("host", "user", "pwd"); mysql_select_db("dbname"); $query = 'SELECT imagefiled FROM imagetabel WHERE id = '.$id; $result = mysql_query($query); if(mysql_num_rows($result) > 0) { //You got the image header("Content-type: image/jpeg"); $row = mysql_fetch_row($result); echo $row[0]; } else { //No image with that id! } mysql_close($connection); ?> HTML file where the image is: <html> <body> <img src="phpfile.php?id=23" border=0 alt=""> </body> </html> Dont know if you misunderstand you? Regards, Johan