Zoque.Forum
»
blob datadan okuyup resim olusturma
|
| Veritabanları MySQL , MSSQL, SQL, Access, Oracle |
![]() |
|
|
LinkBack | Seçenekler |
|
|
#1 (permalink) |
|
Üyelik Tarihi: 09.11.2006
Yer: izmir
Mesaj: 193
|
blob datadan okuyup resim olusturma
selam arkadaslar. şimdi PHP ve MySQL ile resimleri blob data olarak veritabanında saklayabiliyoruz. aşağıdaki kod ilede blob datadan veriyi alabiliyoruz
HTML Code:
$MySQL=@mysql_pconnect('localhost','root','') or die ('My-SQL e baglanilamadi'); $db_connect=@mysql_select_db('database') or die ('veri Tabanina baglanilamadi'); $sor=mysql_query("select * from tablo where id='4'"); $lis=mysql_fetch_array($sor); $fileType=$lis[$alan2]; $fileContent=$lis[$alan1]; header("Content-type: $fileType"); echo $fileContent; HTML Code:
$ThumbWidth="400";
$file_tmp="resim.jpg";
$new_img = imagecreatefromjpeg($file_tmp);
list($width, $height) = getimagesize($file_tmp);
$imgratio=$width/$height;
if ($imgratio>1){
$newwidth = $ThumbWidth;
$newheight = $ThumbWidth/$imgratio;
}else{
$newheight = $ThumbWidth;
$newwidth = $ThumbWidth*$imgratio;
}
//function for resize image.
if (function_exists(imagecreatetruecolor)){
$resized_img = imagecreatetruecolor($newwidth,$newheight);
}else{
die("Error: GD Kütüphanesinin versiyonu 2 ve üzeri olmalıdır");
}
imagecopyresized($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
//save image
ImageJpeg ($resized_img,"dosyalar/resimdeneme.jpg");
ImageDestroy ($resized_img);
ImageDestroy ($new_img);
|
|
|
|
Zoque'a hoşgeldiniz!