Datuve :: Forums :: Arhīvs :: image resize, PHP

Datuve

Mana Datuve

Reģistrācija | Noteikumi | Paroles atjaunošana



Forums

Ieskaties


Raksti

Lietotāji online

Lietotāji online: 91

Reģistrētie lietotāji online: 0

Viesi online: 91

Datuve.lv video
Top.LV

image resize, PHP

Ievietoja: Sternwolf @ 2006.03.07 11:49  

Sekojošais skripts tomēr ir bremzīgs un ielādē visu lielo attēlu?
<?php
$filename = 'kivere.jpg';
$width = 360;
$height = 360;
header('Content-type: image/jpeg');
list($width_orig, $height_orig) = getimagesize($filename);
if ($width && ($width_orig < $height_orig)) {
  $width = ($height / $height_orig) * $width_orig;
} else {
  $height = ($width / $width_orig) * $height_orig;
}
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
imagejpeg($image_p, null, 100);
?>