možda ti ovo pomogne:
dio predloska za sliku:
Code:
...
<img src="drawslika.php?nwidth=<!--SLIKA_WIDTH-->" Style="width: <!--SLIKA_WIDTH-->px; height: auto;" border="1">
...
drawslika.php - čitanje iz mysql baze:
Code:
<?php
//drawslika.php?id=nn
include('config.php');
$sirina=$_REQUEST['nwidth'];
mysql_connect ($host, $username, $password) OR DIE ("Could not connect to MySQL");
mysql_select_db($database) OR DIE ("Can't select database.");
$result=mysql_query("SELECT naziv, tip, slika FROM tabela");//naziv=ime fajla, tip=mime type, slika= blob
$row=mysql_fetch_object($result);
$tip=$row->tip;
$data=$row->slika;
//$data = base64_decode($data);
$im = imagecreatefromstring($data);
if ($im == false) {
echo "ERROR!";
exit;
}
if($rs){
//resize slike
$new_width=$sirina;
$new_height=0;
$iwidth=imagesx($im);
$iheight=imagesy($im);
//nova visina
$dif=$new_width/$iwidth;
$new_height=$iheight*$dif;
//nova slika
$image_p = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($image_p, $im, 0, 0, 0, 0, $new_width, $new_height, $iwidth, $iheight);
if(strpos($tip, "jpeg")){
header('Content-Type: $tip');
imagejpeg($image_p,null,100);
}elseif(strpos($tip, "png")){
header('Content-Type: $tip');
imagepng($image_p,null,100);
}elseif(strpos($tip, "gif")){
header('Content-Type: $tip');
imagegif($image_p,null,100);
}
}else{
//originalna velicina
Header( "Content-type: $tip");
echo $row->slika;
}
exit;
?>
znači išlo bi ovako:
1. sa nekom skriptom generiraš template i usput postaviš širinu slike (<!--SLIKA_WIDTH-->)
2. prikažeš html, a drawslika.php se sam okine i generira sliku.[code][code][code][code]
[sub][[b]Ovu poruku je menjao zimbala dana 03.12.2007. u 15:43 GMT+1[/b]][/sub]