Jump to content

PHP GD save DPI


illegaljose

Recommended Posts

I am using the below code to render and save a photo for printing but it is saving it at 72 DPI and I need it to save at 300 DPI. I believe that what needs to happen is on save the header of the JPG is modified from 72 to 300. The image dimensions need to stay the same. HELP!!!

 

<?

ini_set("memory_limit","100M");

// Retrieve the URL variables (using PHP).
$image = $_GET['image'];

//save image
$save = "hotfolder/$image-2.jpg";

// Load the stamp and the photo to apply the watermark to
$stamp = imagecreatefromjpeg("$folder/" . $image . ".jpg");

// Create image
$im = imagecreatetruecolor( 2400, 3000 );
$background = imagecolorallocate($im, 255, 255, 255);
imagefilledrectangle($im, 2400, 3000, $width - 1, $height - 1, $background);

// Set the margins for the stamp and get the height/width of the stamp image
$marge_right = 0;
$marge_bottom = 0;
$sx = imagesx($stamp);
$sy = imagesy($stamp);

// Copy the stamp image onto our photo using the margin offsets and the photo
// width to calculate positioning of the stamp.
imagecopy($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp));

//save the image
imagejpeg($im, $save, 100) ;
imagedestroy($im);

?>

Link to comment
https://forums.phpfreaks.com/topic/166267-php-gd-save-dpi/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.