[ g_o_g_o @ 26.06.2006. 08:50 ] @
| Nikako da mi se poslje resize-a prikaže slika samo kod !!!
Server ima podršku za GD biblioteku !!!
Molim pomoć !!!
Hvala !
Goran
<?
header("Content-type: image/jpeg");
$ime = "ime_slike.jpg";
$kakvocha = 70;
$izvor = imagecreatefromjpeg($ime);
$maliDuzina = 100;
$slikaSirina = imagesx($izvor);
$slikaDuzina = imagesy($izvor);
$maliSirina = (int)(($maliDuzina*$slikaSirina) / $slikaDuzina );
$dest = imagecreatetruecolor($maliSirina, $maliDuzina);
imagecopyresampled ($dest, $izvor, 0, 0, 0, 0, $maliSirina, $maliDuzina, $slikaSirina, $slikaDuzina);
imagejpeg($dest,'',$kakvocha);
imagedestroy($dest);
imagedestroy($izvor);
?>
[Ovu poruku je menjao g_o_g_o dana 26.06.2006. u 11:33 GMT+1] |
[ glavince @ 26.06.2006. 10:19 ] @
U phpinfo(); proveri dali imas GD biblioteku.
[ g_o_g_o @ 26.06.2006. 10:37 ] @
Server ima podršku za GD biblioteku !!!
npr . ovo radi !!!
<?
$slika_karte = "ime_slike.jpg";
$name = "gogo";
$country = "HRV";
$passport = "HR4764390";
$karta = imagecreatefromjpeg($slika_karte);
imagestring($karta,2,61,77,$name,0);
imagestring($karta,2,75,96,$country,0);
imagestring($karta,2,80,115,$passport,0);
$narandzasta = imagecolorallocate($pic, 220, 210,60);
imagestring($karta,2,80,115,$passport,$narandzasta);
imagejpeg($karta);
imagedestroy($karta);
?>
[ glavince @ 26.06.2006. 12:55 ] @
Za prikaz slike trebalo bi da koristis
<img src = ime_fajla.php?ime=ime_slike.jpg>
Uslov je da ime_fajla.php i ime_slike.jpg budu u isti dir.
Sa ovim kodom mozes da obradzujes samo JPG.
[ dragancesu @ 30.06.2006. 10:59 ] @
Evo ti primer iz jedne knjige
Code:
<?php
$image = $_REQUEST['image'];
$max_width = $_REQUEST['max_width'];
$max_height = $_REQUEST['max_height'];
if (!$max_width)
$max_width = 80;
if (!$max_height)
$max_height = 60;
$size = GetImageSize($image);
$width = $size[0];
$height = $size[1];
$x_ratio = $max_width / $width;
$y_ratio = $max_height / $height;
if ( ($width <= $max_width) && ($height <= $max_height) ) {
$tn_width = $width;
$tn_height = $height;
}
else if (($x_ratio * $height) < $max_height) {
$tn_height = ceil($x_ratio * $height);
$tn_width = $max_width;
}
else {
$tn_width = ceil($y_ratio * $width);
$tn_height = $max_height;
}
$src = ImageCreateFromJpeg($image);
$dst = ImageCreate($tn_width,$tn_height);
ImageCopyResized($dst, $src, 0, 0, 0, 0,
$tn_width,$tn_height,$width,$height);
header('Content-type: image/jpeg');
ImageJpeg($dst, null, -1);
ImageDestroy($src);
ImageDestroy($dst);
?>
[ glavince @ 01.07.2006. 22:54 ] @
Dobar je ovaj primer, ali ja bi zamenio:
$dst = ImageCreate($tn_width,$tn_height);
u
$dst = imagecreatetruecolor($tn_width,$tn_height);
Da bi bile prikazane truecolor od slike
[ g_o_g_o @ 03.07.2006. 07:12 ] @
Sada radi !!!
Hvala !!!
Goran
Copyright (C) 2001-2025 by www.elitesecurity.org. All rights reserved.