Autor Zpráva
Lech
Profil *
Mam script na zmenseni obrazku:

header("Content-type: image/jpeg");



$src = "blesk.jpg";
$wmax = 100;
$hmax = 100;
$quality = 100;
$bgcol = "FFFFFF";




$source = imagecreatefromjpeg($src);
$orig_w=imagesx($source);
$orig_h=imagesy($source);

if ($orig_w>$wmax || $orig_h>$hmax)
{
$thumb_w=$wmax;
$thumb_h=$hmax;
if ($thumb_w/$orig_w*$orig_h>$thumb_h)
$thumb_w=round($thumb_h*$orig_w/$orig_h);
else
$thumb_h=round($thumb_w*$orig_h/$orig_w);
} else
{
$thumb_w=$orig_w;
$thumb_h=$orig_h;
}
if (!@$bgcol)
{
$thumb=imagecreatetruecolor($thumb_w,$thumb_h);
imagecopyresampled($thumb,$source,
0,0,0,0,$thumb_w,$thumb_h,$orig_w,$orig_h);
}
else
{
$thumb=imagecreatetruecolor($wmax,$hmax);
imagefilledrectangle($thumb,0,0,$wmax-1,$hmax-1,intval($bgcol,16));
imagecopyresampled($thumb,$source,
round(($wmax-$thumb_w)/2),round(($hmax-$thumb_h)/2),
0,0,$thumb_w,$thumb_h,$orig_w,$orig_h);
}
if (!@$quality) $quality=90;
imagejpeg($thumb,"",$quality);

imagedestroy($thumb);



a mam jednoduchy problem... tohle mi ten zmenseny obrazek zobrazi... ale ja chci ten zmenseny ulozit na server... co tam mam zmenit?
Falcon16
Profil
Moc sa mi nechce hladat v tvojom scripte ako mas premenne (ale pre upravovany obrazok mas tusim premennu $thumb), ale staci ked si zmenis premenne na svoje
Imagejpeg ($imgnew,$imgdest);
$imgnew - je obrazok, ktory si upravoval
$imgdest - je cielova adresa toho obrazku.
V takom pripade netreba ani header na zaciatku dokumentu
Toto téma je uzamčeno. Odpověď nelze zaslat.

0