Jump to content

increasing image size without effecting much of quality using gd library


rabikhadka

Recommended Posts

thank you, but the image quality gets worst when increase the site. i used this code

 

<?php

// The file

$filename = '24.jpg';

$percent = 3;

 

// Content type

header('Content-type: image/jpeg');

 

// Get new dimensions

list($width, $height) = getimagesize($filename);

$new_width = $width * $percent;

$new_height = $height * $percent;

 

// Resample

$image_p = imagecreatetruecolor($new_width, $new_height);

$image = imagecreatefromjpeg($filename);

imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);

 

// Output

imagejpeg($image_p, null, 100);

?>

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.