Resimler yüklenmeden önce boyutunu ayarlamam gerekiyor. Gd kütüphanesi ile yapacağım sanırım ama baktım epey fonksiyon var kafam karıştı iyice.
Resmi kaydetmeden bir thumb'unu alacağım birde 800x400px 'lik boyuta orantılayıp kaydedeceğim.
Hangi fonksiyonları kullanmam lazım ?
Resimin boyutunu değiştirme
3
●706
- 11-12-2009, 22:49:36Üyeliği durdurulduburadan indiriyorsun gerekli classı.
daha sonra aşağıdaki kod ile işlemler yapıyorsun.kolay gelsin.
<?php require_once '/path/to/ThumbLib.inc.php'; $thumb = PhpThumbFactory::create('test.jpg'); $thumb->resize(100, 100)->save('/path/to/new_thumb.jpg'); ?> - 11-12-2009, 23:46:08Üstat çok teşekkürler fonksiyon dışında kullandım sorunsuz işlem yapabildim ama fonksiyon içinde kullanırken aşağıdaki hatayı alıyorum.
Fatal error: Uncaught exception 'RuntimeException' with message 'File not writeable: http://localhost/Thumb/' in C:\AppServ\www\Functions \image_size_adjusment\GdThumb.inc.php:662 Stack trace: #0 C:\AppServ \www\Functions\b-3.php(417): GdThumb->save('http://localhos...') #1 C:\AppServ\www\Admin\Admin.php(162): image_insert_pc() #2 {main} thrown in C:\AppServ\www\Functions\image_size_adjusment \GdThumb.inc.php on line 662global olarak sınıfı çağırıyorum şu şekilde
global $Site,$db,$PhpThumbFactory;
buda kullanmaya çalıştığım yer
<?php function image_insert_pc(){ global $Site,$db,$PhpThumbFactory;?> <div id="sag"> <div class="admin-sag"> <div class="admin-q"> <?php $title = UTF($_POST['title']); $seo = SEO($title); $tag = UTF($_POST['tag']); $statemant = UTF($_POST['statemant']); $date = date("d/m/Y H:i:s"); $categori = $_POST['categori']; if(empty($title)):?> ! HATA ! Başlık alanı boş gönderildi. <?php header('refresh:2; url=' . $Site . 'Admin/Admin.php?do=image_insert'); else: $thumb = PhpThumbFactory::create($_FILES['image']['tmp_name']); $img_small = 'new_thumb.jpg'; $thumb->resize(100, 100)->save($Site . 'Thumb/' . $img); if(! $img_big && ! $img_small):?> Resimler kopyalanamadı. Thumb ve images klasörlerinin chmod ayarlarının 777 olduğuna emin olun. <?php else: $sql = $db->query("INSERT INTO images (title,seo_title,categori,image_small,image_big,date,statemant,tag) VALUES ('$title','$seo','$categori','$img_small','$img_small','$date','$statemant','$tag')"); if($sql):?> Resim ekleme başarılı <?php header('refresh:2; url=' . $Site . 'Admin/Admin.php?do=image_insert'); else:?> Resim ekleme başarısız <?php header('refresh:2; url=' . $Site . 'Admin/Admin.php?do=image_insert'); endif; endif; endif;?> </div> </div> </div> <?php } ?>
