it gets kinda square x_x
--
here's another thing you can do..
since the level 0 of my adoptables are eggs, there's no pointing of showing 'level 0'
PHP Code:
if($currentlevel == 0){
$str2 = "Help me Hatch!";
}
now I'm trying to resize the image x_x
if i change the newwidth, the image gets cropped, but I want to resize it, so all images are the same size independent of the adoptable... any ideas? '-'
- edit -
I found a way to do it :D
if someone wants to know...
you have to change this part:
ImageCopyResampled(
$img_temp,
$img_old,
0, 0, 0, 0,
$width,
$height,
$width,
$height
);
I wanted all my images to be 140 x 150 max (with text), so here's what I did
PHP Code:
if($width < 140 AND height < 120){
$wresized = $width;
$hresized = $height;
}
else{
$div = $width / 140;
$wresized = $width / $div;
$hresized = $height / $div;
if($hresized > 120){
$div = $height / 120;
$wresized = $wresized / $div;
$hresized = $hresized / $div;
}
}
first verifies if the image is bigger than 140x120 (the text is 30 pixels height). if it is not, than the new WxH is the same of the original... if it is bigger, we resize it.. I used that $div so it will be resized and maintain the porpotion of the sides..
and you have to change those parts also
PHP Code:
$newwidth = $wresized;
$newheight = $hresized + 30;
$img_temp = imagecreatetruecolor($newwidth, $newheight);
PHP Code:
ImageCopyResampled(
$img_temp,
$img_old,
0, 0, 0, 0,
$wresized,
$hresized,
$width,
$height
);
PHP Code:
$textheight = $hresized + 2;