hi everyone
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 displayed a lot of "ÿØÿàJFIFÿ þ‡úý<ÿyºÿ&Ïþ <ߗש" characters
here is what i did:
[PHP]
//some code
function resizeimage($im ages)
{
// Retrieving path
$filename = $images;
// Set a maximum height and width
$width = 100;
$height = 100;
// Get new dimensions
list($width_ori g, $height_orig) = getimagesize($f ilename);
$ratio_orig = $width_orig/$height_orig;
if ($width/$height > $ratio_orig) {
$width = $height*$ratio_ orig;
} else {
$height = $width/$ratio_orig;
}
// Resample
$image_p = imagecreatetrue color($width, $height);
$image = imagecreatefrom jpeg($filename) ;
imagecopyresamp led($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
// Output
$new=imagejpeg( $image_p, null, 100);
}
[/PHP]
then after some other code, i wrote:
[PHP]
$img=$newRow['picture'];
echo "<a href=\"test1.ph p\"><img src=resizeimage ($img) border=0></a>";
[/PHP]
$newRow['picture'] is the path of the image saved in the database
anyone has an idea of why it is not working properly?
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 displayed a lot of "ÿØÿàJFIFÿ þ‡úý<ÿyºÿ&Ïþ <ߗש" characters
here is what i did:
[PHP]
//some code
function resizeimage($im ages)
{
// Retrieving path
$filename = $images;
// Set a maximum height and width
$width = 100;
$height = 100;
// Get new dimensions
list($width_ori g, $height_orig) = getimagesize($f ilename);
$ratio_orig = $width_orig/$height_orig;
if ($width/$height > $ratio_orig) {
$width = $height*$ratio_ orig;
} else {
$height = $width/$ratio_orig;
}
// Resample
$image_p = imagecreatetrue color($width, $height);
$image = imagecreatefrom jpeg($filename) ;
imagecopyresamp led($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
// Output
$new=imagejpeg( $image_p, null, 100);
}
[/PHP]
then after some other code, i wrote:
[PHP]
$img=$newRow['picture'];
echo "<a href=\"test1.ph p\"><img src=resizeimage ($img) border=0></a>";
[/PHP]
$newRow['picture'] is the path of the image saved in the database
anyone has an idea of why it is not working properly?
Comment