note 83347 added to function.imagejpeg
| From: | xavi at lapalomera dot com | Date: | Wed, 21 May 2008 18:11:38 +0000 |
| Subject: | note 83347 added to function.imagejpeg | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-139592@lists.php.net to get a copy of this message | ||
For those whom needs other dpi image than the GD library, just do the following:
<?php
//Get jpeg image contents
ob_start();
imagejpeg($image, "", 100);
$image = ob_get_contents();
ob_end_clean();
//Or read jpeg image
$image = file_get_contents($file);
//Replace header image info to set DPI as units and the density for X and Y
//First parameter are units for X and Y densities (0x00 No units, 0x01 DPI, 0x02 DPC)
//Second parameter is the X density
//Third parameter is the Y density
$image = substr_replace($image, pack("Cnn", 0x01, 300, 300), 13, 5);
header("Content-type: image/jpeg");
header('Content-Disposition: attachment;
filename="'.basename($file).'"');
echo $image;
?>
----
Server IP: 130.206.1.5
Probable Submitter: 212.97.175.162
----
Manual Page -- http://www.php.net/manual/en/function.imagejpeg.php
Edit -- https://master.php.net/note/edit/83347
Del: integrated -- https://master.php.net/note/delete/83347/integrated
Del: useless -- https://master.php.net/note/delete/83347/useless
Del: bad code -- https://master.php.net/note/delete/83347/bad+code
Del: spam -- https://master.php.net/note/delete/83347/spam
Del: non-english -- https://master.php.net/note/delete/83347/non-english
Del: in docs -- https://master.php.net/note/delete/83347/in+docs
Del: other reasons-- https://master.php.net/note/delete/83347
Reject -- https://master.php.net/note/reject/83347
Search -- https://master.php.net/manage/user-notes.php