• 01-06-2006, 18:32:34
    #1
    Misafir
    " thumbnail özelliği ile resim küçültme yapıyorum ancak bu resimler klasorde değil de SQL de kayıtlı. Longblob ile SQL ye yükledim ve resim.php?rid=xx şeklinde resmi gösteriyorum. ancak bunun üzerinde küçültme yapamıyorum. bunun için ne yapmam lazım. ? "


    Kullandığım kod bu :


    <? 
    $f = "resim.php?rid=15"; 
    $w = 64; 
    $h = 64; 
        $im = imagecreatetruecolor ($w, $h);  
        $imx = imagecreatefromgif($f);  
        $xxx = getimagesize($f);  
        imagecopyresampled($im, $imx, 0, 0, 0, 0, $w, $h, $xxx[0], $xxx[1]);  
        imagejpeg ($im);  
        imagedestroy($im);  
        imagedestroy($imx); 
    ?>
    ancak burada resim.php?rid=15 yazılan yeri kabul etmiyor. illa gif resim olacak ve bir klasor altında olacak diyor.
  • 01-06-2006, 19:10:45
    #2
    <? 
    $f = file("http://site.com/resim.php?rid=15"); 
    $w = 64; 
    $h = 64; 
        $im = imagecreatetruecolor ($w, $h);  
        $imx = imagecreatefromgif($f);  
        $xxx = getimagesize($f);  
        imagecopyresampled($im, $imx, 0, 0, 0, 0, $w, $h, $xxx[0], $xxx[1]);  
        imagejpeg ($im);  
        imagedestroy($im);  
        imagedestroy($imx); 
    ?>
    şeklind denedin mi
    olmazsa path olarak adres yazıp dene
    yine olmazsa resim.php nin kodlarını görelim
  • 01-06-2006, 19:48:45
    #3
    Misafir
    Resimleri SQL den okuyorum.

    <?php
    Header("Content-type: Image/gif");// veya image/pjpeg
    include('ayar.php');
    $islem="select d_id,d_resim from dosyalar WHERE d_id='$rid'";
    $sonuc=mysql_db_query($dbname,$islem);
    while($soyturk=mysql_fetch_array($sonuc))
    {
    $resimim = $soyturk['d_resim'];
    }

    echo $resimim;

    ?>
  • 01-06-2006, 19:59:46
    #4
    Misafir

    $imx = imagecreatefromgif($f);
    $xxx = getimagesize($f);


    sorun burda, neyin size ını alıyorsun yaratamadığın gif in mi

    http://tr2.php.net/manual/en/functio...fromstring.php

    incele istersen birde image boyutlarınıda istersen db de tut ordan çek daha sağlıklı
  • 01-06-2006, 20:14:59
    #5
    Misafir
    hataların orada olduğu belli.
    benim sorunum şu


    Veritabanına eklenmiş resim var. Longblob türü ile..
    Bunu resim.php ile çekiyorum ve resim gözüküyor ancak orjinal ebatı ile. ben burada çektiğim resmi küçültmek istiyorum

    <?  
    $f = "asdasd.gif";
    $w = 64;  
    $h = 64;  
        $im = imagecreatetruecolor ($w, $h);   
        $imx = imagecreatefromgif($f);   
        $xxx = getimagesize($f);   
        imagecopyresampled($im, $imx, 0, 0, 0, 0, $w, $h, $xxx[0], $xxx[1]);   
        imagejpeg ($im);   
        imagedestroy($im);   
        imagedestroy($imx);  
    ?>
    Bu şekilde okuttuğun zaman resmi 64 x 64 e küçültüyor
    jpeg olduğu zaman $imx = imagecreatefrompjpeg($f); yapıyorsun resmi 64x64 e küçültüyor.
    Veritabanına yüklediğim resimleri resim.php?id=15 şeklinde alıyorum ve bunu gif olarak yazdırıyorum. sonraki aşamada

    kucult.php
    <?  
    $f = "resim.php?id=15";
    $w = 64;  
    $h = 64;  
        $im = imagecreatetruecolor ($w, $h);   
        $imx = imagecreatefromgif($f);   
        $xxx = getimagesize($f);   
        imagecopyresampled($im, $imx, 0, 0, 0, 0, $w, $h, $xxx[0], $xxx[1]);   
        imagejpeg ($im);   
        imagedestroy($im);   
        imagedestroy($imx);  
    ?>
    şeklinde küçültmek istiyorum ve bunu yapamadım