Iam new to this forum.
I have written a program to upload an image and resize the image based on the distance between the eyes. Iam posting the code below. Please let me know whether my logic is correct.Iam resizing it so that the distance between the pupils in all the resized images is 128.
Any Suggestions from your side would be of great help to me.
Thank you
Amrita
Code: Select all
<?php
function resizeimage($filena,$val,$ed)
{
$filename = 'files/'.$filena;
$width = "";
$height = "";
$percent=$ed;
header('Content-type: image/jpeg');
list($width_orig, $height_orig) = getimagesize($filename);
$width=($width_orig*128)/$percent;
$height =(height_orig*width)/width_orig;
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
imagejpeg($image_p, null, 100);
$pieces = explode(".", $filena);
$pieces[0];
$pieces[1];
$new_filename=$pieces[0]."_modi.".$pieces[1];
$image_path = $_SERVER["DOCUMENT_ROOT"]."/Amrita/files/".$new_filename;
imagejpeg($image_p,$image_path);
return $new_filename;
}
?>Code: Select all
[/php ] tags when posting code in the forum[/color]