i need some help please
i am using PHP5 and i used a tutorial and when i copied the code for Resampling an image proportionally, it worked perfectly
but when i added it in my page it did not work
here is what i did:
Code: Select all
function resizeimage($images)
{
// Retrieving path
$filename = $images;
// Set a maximum height and width
$width = 100;
$height = 100;
// Get new dimensions
list($width_orig, $height_orig) = getimagesize($filename);
$ratio_orig = $width_orig/$height_orig;
if ($width/$height > $ratio_orig) {
$width = $height*$ratio_orig;
} else {
$height = $width/$ratio_orig;
}
// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
// Output
$new=imagejpeg($image_p, null, 100);
return $new;
}Code: Select all
$img=$newRow['picture'];
echo "<a href=\"test1.php\">resizeimage($img)</a>";however, the picture doesn't display but it displays for example:
resizeimage(images/d500.jpg)
can someone help me figure what the problem is please?