Jump to content

Recommended Posts

hi

 

i am running this php image resize and crop script

function img_process($max_width, $max_height, $source_file, $dst_dir)
{
$imgssize = getimagesize($source_file);
$width = $imgssize[0];
$height = $imgssize[1];
$mime = $imgssize['mime'];
$dst_imgs = imagecreatetruecolor($max_width, $max_height);
$src_imgs = imagecreatefromjpeg($source_file);
$width_new = $height * $max_width / $max_height;
$height_new = $width * $max_height / $max_width;
if($width_new > $width)
{
$h_point = (($height - $height_new) / 2);
imagecopyresampled($dst_imgs, $src_imgs, 0, 0, 0, $h_point, $max_width, $max_height, $width, $height_new);
}
else
{
$w_point = (($width - $width_new) / 2);
imagecopyresampled($dst_imgs, $src_imgs, 0, 0, $w_point, 0, $max_width, $max_height, $width_new, $height);
}
imagejpeg($dst_imgs, $dst_dir, 100);
if($dst_imgs)imagedestroy($dst_imgs);
if($src_imgs)imagedestroy($src_imgs);
}

can anyone tell me how to get it producing higher quality images?

 

thanxs

Link to comment
https://forums.phpfreaks.com/topic/283478-high-res-image-resizer/
Share on other sites

Just for info's sake...

 

There may be a way using the HTML5 canvas, create it at a size then use canvas.scale(), there is a way to save this image ut can't remember it since never used it, only drawback is that it may have to be done clientside if that's acceptable?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.