Re: Retrieving Image Location in PHP from MySQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Mar 7, 2009 at 9:36 PM, Sashikanth Gurram <sashi34u@xxxxxx> wrote:

> The thing is, I do not have a website or a place where I am storing my
> images. I am storing the images on my local PC in folder as mentioned in my
> earlier post. I have tried using only the
>
> else {
> header('Content-Type: image/jpeg');
> imagejpeg($img);
> imagedestroy($img);
> }
>
> Which you have suggested. This is the piece of code which is returning all
> the binary character stuff. The code is definitely fetching the image. But
> it is not able to deliver to the browser in the form of an image. I am
> trying to read the image file as binary, evident from the FILE_BINARY
> command. So may be, that is causing the image to be displayed as binary. Is
> there any way we can convert the binary content to jpeg/jpg content again.
> This is my guess after having gone through the code again.


i spent 2 minutes working on it and read this in the manual,

the first param of imagejpeg(),

An image resource, returned by one of the image creation functions, such as
imagecreatetruecolor()<http://us.php.net/manual/en/function.imagecreatetruecolor.php>
.

so, then i tossed this together,

http://nathan.moxune.com/echoImage.php

<?php
header('Content-Type: image/jpeg');
imagejpeg(imagecreatefromjpeg('./phpLogo.jpeg'));

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux