• 07-10-2009, 14:01:00
    #1
    Üyeliği durduruldu
    Selamlar arkadaşlar,
    Şu kodla bir dizindeki resimleri çekip gösteriyorum, fakat bunları sayfalayamadım. Yardımcı olursanız sevinirim.
    <?php
    $imgdir = 'img'; 
    $allowed_types = array('png','jpg','jpeg','gif');
    $dimg = opendir($imgdir);
    while($imgfile = readdir($dimg))
    {
    if(in_array(strtolower(substr($imgfile,-3)),$allowed_types))
    {
    $a_img[] = $imgfile;
    sort($a_img);
    reset ($a_img);
    }
    }
    $totimg = count($a_img); 
    for($x=0; $x < $totimg; $x++)
    {
    $size = getimagesize($imgdir.'/'.$a_img[$x]);
    $halfwidth = ceil($size[0]/2);
    $halfheight = ceil($size[1]/2);
    ?>
    <li><img src="img/<?=$a_img[$x];?>" /></li>
    <?
    }
    ?>
    Şimdiden teşekkürler.
  • 07-10-2009, 22:16:32
    #2
    Üyeliği durduruldu
    yokmu arkadaşlar
  • 07-10-2009, 22:56:42
    #3
    Kimlik doğrulama veya yönetimden onay bekliyor.
    	
    <?php
    	$kodsorgusu = "SELECT * FROM yresimler WHERE projeno='" . $sonuc->no . "'";
    		$sonuclar = $db->get_results($kodsorgusu);
    		if ($sonuclar) {
    			foreach ($sonuclar as $sonuc) {
    			echo '<div class="resim_kutu"><a title="Proje resmi" class="thickbox" href="'.$yAnaSite.'/resimler/'.$sonuc->resim.'"><img src="'.$ySite.'/bilesenler/onizleme.php?src='.$yAnaSite.'/resimler/'.$sonuc->resim.'&w=85"> </a></div>';
    			//echo $sonuc->resim."<br>";
    			}
    		} else
    		{ echo ResimYok; }
    	?>
    Bu resmi göstereceğin kod biraz oynama yapman lazım tabiki burda ezSQL kullanılarak yapılmıştır
    bide önizleme için bir kod koyuyorum

    <?php
    
    
    $w=$_GET["w"];
    if($w>31 && $w<500){
     $thumbnailWidth=$w;
    }else{
     $thumbnailWidth=96;
    }
    
    // dosya turu
    
    $src = $_GET['src'];
    $uz  = explode(".",$src);
    $uz  = $uz[count($uz)-1];
    
    // dosya kaynagini olusturalim
    
    if($uz=="png"){
      header("Content-type: image/png");
      $source = imagecreatefrompng($src);
    }else if($uz=="jpg" || $uz=="jpeg"){
      header("Content-type: image/jpeg");
      $source = imagecreatefromjpeg($src);
    }else if($uz=="gif"){
      header("Content-type: image/gif");
      $source = imagecreatefromgif($src);
    }else{
      exit;
    }
    
    // yeni boyutlari belirleyelim
     
    $thumbX = $thumbnailWidth;
    $imageX = imagesx($source);
    $imageY = imagesy($source);
    $thumbY = (int) (($thumbX * $imageY) / $imageX );
    $dest   = imagecreatetruecolor($thumbX, $thumbY);
     
    // eski kaynagi yeni boyutlarla yeni kaynaga kopyalayalim
    
    imagecopyresampled ($dest, $source, 0, 0, 0, 0, $thumbX, $thumbY, $imageX, $imageY);
    
    // ve kaynagi ekrana basalim.
    
    if($uz=="png"){
      imagepng($dest);
    }else if($uz=="jpg" || $uz=="jpeg"){
      imagejpeg($dest);
    }else if($uz=="gif"){
      imagegif($dest);
    }else{
      exit;
    }
    
    // kaynaklari yok edelim
    
    imagedestroy($dest);
    imagedestroy($source);
     
    ?>
    Buda önizleme için dosyayı yükledikten sonra onizlemeyi kullanacağın faliyete göre değişir tabiki