Minik resimler oluşturan bu kodları web sitesinde başka bir yere koymadan yazdırayım. Bunu yaptığımda ve çıktıyı gösterdiğinde, bu iyi çalışıyor.Küçük resimleri küçük resimleri oluşturmadan kaydedin
imageThumbnail.php
header("Content-type: image/png");
$im = imagecreatefrompng("image.png");
list($width, $height) = getimagesize($im);
$newimage = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($newimage, $im, 0, 0, 0, 0, "100", "100", $width, $height);
imagepng($newimage);
imagedestroy($newimage);
imagedestroy($im);
Bu kod i bu imageThumbnail
php dosyasına bazı veri göndermek ve daha sonra veritabanına bir sorgu yapmak ve doğru bulmaktı istediğini Şimdi burada creating thumbnails without saving them
alındı Alınan belirli bir veri için yol, ancak çıkış, beklendiği gibi değildi ve görüntü görünmüyordu.
imageThumbnail.php
This is the modified code
header("Content-type: image/jpeg");
$productCode=$_GET['product_code'];
require 'connect.inc.php';
$statement=$mysqli->prepare("select `product_img_name` from `products` where `product_code`=?");
$statement->bind_param("s",$productCode);
$statement->execute();
$result=$statement->get_result();
while($row=$result->fetch_object())
$pathName=$row->product_img_name;
$im=imagecreatefromjpeg("cart/images/".$pathName);
$width=imagesx($im);
$height=imagesy($im);
$newimage=imagecreatetruecolor(116,116);
imagecopyresampled($newimage, $im, 0, 0, 0, 0,'116', '116', $width, $height);
imagejpeg($newimage);
imagedestroy($newimage);
imagedestroy($im);
Ne sorundur ve nasıl ben bunu başarmak yok
Html code
<img src ="imageThumbnail.php?product_code=PD1001" alt="some description"/>
?
biz gerçekten sorunuzu yanıtlamak için bu kodu tüm ihtiyacınız var mı? – m02ph3u5
Evet, bence tüm bunlar önemli ve benim sorum ile ilgili. @ m02ph3u5 – Mitali
@ m02ph3u5 sorumuzu daha az kodla güncelledi – Mitali