ok I tried your code but I'm getting a whole bunch of strange characters. this is my code:
PHP Code:
<?php
include('includes/inc_common.php');
//================================================
function imageResize1($width, $height, $target) {
//================================================
//takes the larger size of the width and height and applies the
//formula accordingly...this is so this script will work
//dynamically with any size image
if ($width > $height) {
$percentage = ($target / $width);
} else {
$percentage = ($target / $height);
}
//gets the new value and applies the percentage, then rounds the value
$width = round($width * $percentage);
$height = round($height * $percentage);
//returns the new sizes in html image tag format...this is so you
//can plug this function inside an image tag and just get the
return "width=\"$width\" height=\"$height\"";
//================================================
}//end function
//================================================
$UserAvatar = $GLOBALS['AvatarsFilePath'] . "test.jpg";
$mysock = getimagesize($UserAvatar);
$new_width = 75;
$new_height = 60;
$filename = $UserAvatar;
$width = $mysock[0];
$height = $mysock[1];
echo "<img src=\"$UserAvatar\" />";
echo "<img src=\"$UserAvatar\" " . imageResize1($mysock[0], $mysock[1], 75) . " />";
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($image_p, null, 100);
echo "<img src=\"$UserAvatar\" />";
?>
Bookmarks