Jump to content

[SOLVED] diplay images in directory....URGENT!


anf.etienne

Recommended Posts

i have this coding that uploads files and then displays the images within the directory created.....the problem i have is if i upload say 6 images it displays them over 3 columns instead of the full 5 columns set.

 

On top of this it also displays placeholders where there should be a blank space

 

if you go to http://ve-creative.com/test/8/templateEdit2.php and upload 2 images you can see what i mean. the code to view the images is below

 

<?php

$folderPath= $id;
$full_path=$fileL;

$path = "$folderPath"; // path to the directory to read ( ./ reads the dir this file is in)
if ($handle = opendir($path)) {
   while (false !== ($file = readdir($handle))) {
    if ($file != "." && $file != "..") {
        if(!is_dir($file)){
            $item[] = $file;
            }
       }
   }
   closedir($handle);
}

$total_items = count($item);
$max_items = ceil($total_items / 5); // items per <td>
$start = 0;
$end = $max_items

//generate the table
?>
<center>
<table width="650px" border="1" cellspacing="5" cellpadding="5" align="center">
  <tr>
<?php
require_once 'js/iframeRS.js'; 
    for($i=0; $i<5; $i++){
        if($i != 0){
            $start = $start + $max_items;
            $end   = $end + $max_items;
        }

        echo "<td>";
        for($x = $start; $x < $end; $x++){
      $imageL= $path.$item[$x];
      $img_path="http://ve-creative.com/test/8/$imageL";
            // display the item
		echo '<center><p><img src= "'.$path.$item[$x] .'" height="100" width="100"></p></center>';
		echo "<input type=CHECKBOX name=$imageL>";
            echo "<a href=imgEdit.php?img=$img_path>[Edit / resize]</a><br>";        }
    echo "</td>";
    }
   
    ?>
  </tr>
</table>

Link to comment
https://forums.phpfreaks.com/topic/147002-solved-diplay-images-in-directoryurgent/
Share on other sites

<?php
require_once 'js/iframeRS.js'; 
    for($i=0; $i<5; $i++){
        if($i != 0){
            $start = $start + $max_items;
            $end   = $end + $max_items;
        }

        echo "<td>";
?>

 

i take it ill be replacing this part of the coding?

        for($x = $start; $x < $end; $x++){
      $imageL= $path.$item[$x];
      $img_path="http://ve-creative.com/test/8/$imageL";
            // display the item
         echo '<center><p><img src= "'.$path.$item[$x] .'" height="100" width="100"></p></center>';
         echo "<input type=CHECKBOX name=$imageL>";
            echo "<a href=imgEdit.php?img=$img_path>[Edit / resize]</a><br>";        }
    echo "</td>";
    }

 

this part... this is the display portion where u are having issues. There is no where to break columns here.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.