Jump to content

unknown365

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

unknown365's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi! I have a PHP function which I use to resize the images that I get from the database. These are the functions inside my getImage.php: function resize($image){ $background = imagecreatetruecolor(116,84); $source = imagecreatefromjpeg($image); $width= imagesx($source); $height = imagesy($source); header("Content-type: image/jpeg"); if($width>$height){ imagecopyresampled($background,$source,0,0,0,0,116,84,$width,$height); imagejpeg($background); imagedestroy($background); } else{ imagefill($background,0,0,imagecolorallocate($background, 255, 255, 80)); imagecopyresampled($background,$source,20,0,0,0,75,84,$width,$height); imagejpeg($background); imagedestroy($background); } } function getImage($id){ $query="SELECT i.filepath FROM users u, items i WHERE u.userid=i.userid AND u.userid=$id"; $res = mysql_query($query); while ($obj = mysql_fetch_object($res)) { $file = $obj->filepath; return resize($file); } } Basically, I don't have any problems with resizing the image. My problem is that whenever I try to call this function to output in another page either by using <img src="<?=getImage($id)?>" border="0"> OR <img src="getImage.php" border="0">, the image does not show itself. It's as if I didn't call any image. Please help! By the way, I really need the getImage.php to output the image to another page.
  2. I was already able to solve the problem but I was just wondering...does the quality of an image changes if I use GD? Because in my case, the quality of the image i used in GD suddenly had some edges. Is this normal?
  3. Hi Everyone! I want to use PNG-24 in GD so that I would get a better image quality. My problem is that whenever I use PNG-24, the image that i try to call using "imagecreatefrompng" becomes a different image. Also, the image that I use has a transparent background but whenever I use the PNG-24 image, the background becomes white. However in using a PNG-8 image, I don't encounter these two problems. Below are the images that I used PNG-8 (the original look of the image) PNG-24 As can be seen above, the PNG-24 is totally different from the PNG-8. Please help!
×
×
  • 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.