Visa ett inlägg
Oläst 2007-08-11, 10:17 #5
vidirs avatar
vidir vidir är inte uppkopplad
Medlem
 
Reg.datum: Jan 2004
Inlägg: 291
vidir vidir är inte uppkopplad
Medlem
vidirs avatar
 
Reg.datum: Jan 2004
Inlägg: 291
Tack !

Jag testade det du skrev koala men det funkade inte, även om jag bytade till -resize enl. WizKid. (Warning: Division by zero)

jag kollade länken gsoc:

<code lang="Generic">
function resizeImage($file,$scale="",$width="",$height="")
{
// If they wish to scale the image.
if (isset($scale))
{
// Create our image object from the image.
$fullImage = imagecreatefromjpeg($file);
// Get the image size, used in calculations later.
$fullSize = getimagesize($file);
// If there is NOT a thumbnail for this image, make one.
if (!file_exists("tn_".$file))
{
// Create our thumbnail size, so we can resize to this, and save it.
$tnImage = imagecreatetruecolor($fullSize[0]/$scale, $fullSize[1]/$scale);
// Resize the image.
imagecopyresampled($tnImage,$fullImage,0,0,0,0,$fu llSize[0]/$scale,$fullSize[1]/$scale,$fullSize[0],$fullSize[1]);
// Create a new image thumbnail.
imagejpeg($tnImage, "tn_".$file);

// Clean Up.
imagedestroy($fullImage);
imagedestroy($tnImage);
// Return our new image.
return "tn_".$file;
}
// If there is a thumbnail file, lets just load it.
else
return "tn_".$file;
}
// If they want to force whatever size they want.
elseif (isset($width) && isset($height))
{
return "tn_".$file;
}
else
{
return false;
}
}
</code>

As im just looking over the code, it doesnt look like the force size works, i will revise this when i get a chance.

han nämner att force size inte funkar,,?

vad jag förstår så måste GD eller ImageMagick vara installerat på servern?

:P
vidir är inte uppkopplad   Svara med citatSvara med citat