Re: Imagejpeg and image size question
| From: | Tom Rogers | Date: | Thu, 12 Feb 2004 15:08:41 +0000 |
| Subject: | Re: Imagejpeg and image size question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-177521@lists.php.net to get a copy of this message | ||
Hi,
Tuesday, February 10, 2004, 9:50:20 PM, you wrote:
J> Hi,
J> I am new to manipulating JPGs using PHP. But i managed to create an
J> application that displays an JPG image in the browser (see below).
J> I have boiled the code down to the most nesesary.
J> My problem is that when i load the file "c:\file.jpg" directly in the
J> IE browser (using <IMG SRC='c:\file.jpg'>), and then get properties on the
J> image by
J> right clicking in the browser. the size is the same as it is on the HD
J> (83Kb).
J> However when i use the PHP code and get properties on the image by
J> right clicking in the browser. the image size is 264Kb.
J> How come the picture is bigger when loaded trough PHP as it is when
J> loaded trough the browser directly ?
J> best regards
J> John
J> <-----generate_jpg_picture.php starts------->
J> <?php
J> header("Content-type: image/jpeg", true);
J> $path = $_GET['filepath'];
J> $im = imagecreatefromjpeg($path);
J> Imagejpeg($im, '', 100);
J> ImageDestroy($im);
?>>
J> <-----generate_jpg_picture.php ends------->
J> <-----some_file.php starts------->
J> <html>
J> <head>
J> <title>PHP Test</title>
J> </head>
J> <body>
J> <IMG SRC='generate_jpg_picture.php?filepath=<?php echo
J> urlencode("c:\\file.jpg"); ?>'>
J> <IMG SRC='c:\file.jpg'>
J> </body>
J> </html>
J> <-----some_file.php ends------->
Because you are sending it at 100% quality which is no compression, try
backing it off to 30%. Probably the original was not at 100% quality
anyway.
--
regards,
Tom