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

Re: php and ImageJpeg



If a simple code like that is not working, I would suspect that your
apache is not setup to use *.php files as php 'executables'.

Do you have a line like:
    AddType application/x-httpd-php .php .html .phtml .htm .php3

in your /etc/apache/httpd.conf file?


On Thu, Aug 01, 2002 at 04:56:43PM -0400, Rick Pasotto wrote:
> On Wed, Jul 31, 2002 at 04:41:56PM -0700, Expert User wrote:
> > Are you using the right http headers?
> > I am using ImageJpeg to show scaled images and it works fine for me.
> > 
> > If you can post the code snippet, may be I can help.
> 
> Thanks for any help. I've tried to post the minimum that demonstrates
> the problem. (I use php to generate other pages, including some that
> query mysql.)
> 
> When I access the html I get the actual jpg and two 'broken' images.
> 
> When I access the img1.php script directly the browser shows:
> 
> The image 'http://niof.net/tmx/img1.php' cannot be displayed, because it
> contains errors.
> 
> 
> ----- begin simple html driver -----
> <html><head></head>
> <body>
> <table>
> <tr><td>
> 	<img src='img0.jpg' width=256 height=128>
> </td></tr>
> <tr><td>
> 	<img src='img1.php' width=256 height=128>
> </td></tr>
> <tr><td>
> 	<img src='img2.php' width=256 height=128>
> </td></tr>
> </table>
> </body>
> </html>
> ----- end simple html driver -----
> 
> ----- begin img1.php image display code -----
> <?php
>     Header("Content-type: image/jpeg");
>     $im = ImageCreateFromJpeg("img0.jpg");
>     ImageJpeg($im);
>     ImageDestroy($im);
> ?>
> ----- end php image display code -----
> 
> ----- begin img2.php image create code -----
> <?
>     Header("Content-type: image/jpeg");
>     $im = ImageCreate(256,128);
> 	$clr1=ImageColorAllocate ($im, 0, 0, 200);
> 	$clr2=ImageColorAllocate ($im, 255, 255, 255);
> 	Imagefill ($im, 0, 0, $clr1); 
>     imagerectangle ($im, 10, 10, 190, 190, $clr2);
> 	ImageJpeg($im,"newimg.jpg");
>     ImageJpeg($im);
>     ImageDestroy($im);
> ?>
> ----- end php image create code -----
> 
> > On Tue, Jul 30, 2002 at 05:21:25PM -0400, Rick Pasotto wrote:
> > > I am trying to create/manipulate images in php. I have cut-n-pasted
> > > scripts from www.php.net and other sources but I can't get an image to
> > > display in my browser.
> > > 
> > > I'm running 'testing' and everything I've checked (apache, php, libs)
> > > seems to be ok. The only clue I have is that the filesize shown in the
> > > apache log is much too small but shows a 200 status. Shouldn't I be able
> > > to ImageCreateFromJpeg() and then ImageJpeg() to display an unmodified
> > > image?
> > > 
> > > What could I be doing wrong or have wrong on my system?
> 
> -- 
> "A sect or party is an elegant incognito devised to save
> a man from the vexation of thinking."
> 		-- Ralph Waldo Emerson
>     Rick Pasotto    rickp@telocity.com    http://www.niof.net
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: