Merhaba,
Bulmuş olduğunuz kodun birçok yerinde hata var.
Kodun çoğu yeri yıldız (****) ile bloklanmış gibi duruyor, ayrıca
$fileinfo = getimagesize(filetmp);
filetmp önüne $ işareti eksik olduğundan dolayı hatayı alıyorsunuz.
hasansengun adlı üyeden alıntı: mesajı görüntüle
Arkadaşlar Hepinize Merhaba ,
İnternette örneğini bulduğum yapıyı düzenlemeye çalışıyorum ama küçük resim oluştururken aşağıdaki gibi sorunla karşılaşıyorum
Önce aşağıdaki form aracılığıyla resimleri çoklu olarak alıyorum.
<form name="rresimicerial" action="?**************" method="post" enctype="multipart/form-data"><table width="510" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="110" height="25" align="left" valign="middle"><font class="yaz">Dosya Seçiniz</font></td> <td width="15" height="25" align="left" valign="middle"><font class="yaz">:</font></td> <td width="260" height="25" align="left" valign="middle"><input type="file" name="file_img[]" multiple="multiple" size="20" class=""></td> <td width="125" height="25" align="right" valign="middle"><input name="btn_upload" type="submit" value="Load" class="button"></td> </tr> </table></form>
Daha sonra aşağıdaki şekilde işlemden geçiriyorum.
<?php $******** = $_GET["*******"]; if(isset($_POST['btn_upload'])) { function deal_image($i) { $prodcat = $_POST['pcate']; $prodname = $_POST['pname']; $prodec = $_POST['pdesc']; $prodcode = $_POST['pcode']; $prodprice = $_POST['pprice']; $prodffers = $_POST['poffers']; $pDate = $_POST['pdate']; $***** = $_GET["******"]; $filetmp = $_FILES["file_img"]["tmp_name"][$i]; $filename = $_FILES["file_img"]["name"][$i]; $filetype = $_FILES["file_img"]["type"][$i]; $filesize = $_FILES["file_img"]["size"][$i]; $fileinfo = getimagesize(filetmp); $filewidth = $fileinfo[0]; $fileheight = $fileinfo[1]; // GETS FILE EXTENSION $fileextension = pathinfo($filename, PATHINFO_EXTENSION); $microtime = preg_replace('/[^A-Za-z0-9]/', "", microtime()); $filepath = "resimal/hasan/".$microtime.".".$fileextension; $filepath_thumb = "resimal/hasan/thumbs/".$microtime.".".$fileextension; move_uploaded_file($filetmp,$filepath); if($filetype == "image/jpeg") { $imagecreate = "imagecreatefromjpeg"; $imageformat = "imagejpeg"; } if($filetype == "image/png") { $imagecreate = "imagecreatefrompng"; $imageformat = "imagepng"; } if($filetype == "image/gif") { $imagecreate= "imagecreatefromgif"; $imageformat = "imagegif"; } $new_width = "100"; $new_height = "75"; $image_p = imagecreatetruecolor($new_width, $new_height); $image = $imagecreate($filepath); //photo folder imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $filewidth, $fileheight); $imageformat($image_p, $filepath_thumb);//thumb folder $sql = "INSERT INTO `files` (name,*****,title) VALUES ('$filepath','$*****','$filepath_thumb')"; $result = mysql_query($sql); } foreach($_FILES["file_img"]['name'] as $id => $file) {deal_image($id);} } header("Location:?sayfalar=240******************** ****"); die(); ?>
Bütün bu işlemlerin sonucunda resimleri istedim şekilde veritabanına yazıyorum ama thumbnail siyah olarak geliyor Sizce hata nereden kaynaklanıyor ?
Oluşan thumbnail aşağıda.


Yardımlarınız için şimdiden teşekkürler.