• 31-12-2010, 03:29:26
    #1
    Üyeliği durduruldu
    Merhaba

    Databasemdeki bir Tablo'nun

    Image tipini Decode etmek (İçeriğini görmek ) istiyorum.

    Veriyi alıp PHP ile Sitemde Göstereceğim Resim olarak.

    Ama nasıl Decode Edeceğimi veya PHP ile nasıl Okuyacağımı bulamadım.
    Yardımcı Olursanız sevinirim.
  • 01-01-2011, 06:21:12
    #2
    $query = "select resim from tabloadi where id=bilmemne";
    $get = mssql_query($query);
    
    $row = mssql_fetch_assoc($get);
    
    $image = $row['resim'];
    
    function hex2bin($h)
      {
      if (!is_string($h)) return null;
      $r='';
      for ($a=0; $a<strlen($h); $a+=2) { $r.=chr(hexdec($h{$a}.$h{($a+1)})); }
      return $r;
      }
    
    $image = hex2bin($image);
    
    header("Content-type: image/gif");
    
    print $image;
    
    exit;