Jump to content

open dir


adam291086

Recommended Posts

steps to be followed

1. Fix the number of pictures to be displayed on each page. $perPage - Hardcode this value into all the code pages

2. Read total number of pictures in an array - find the total number of pictures. $totalPictures

3. use some simple math functions i.e. mod & div to find how many times this iteration would be required

4. Display the number of pictures as per $perPage

 

simple isnt it ? lemme know if you have questions

Link to comment
https://forums.phpfreaks.com/topic/81693-open-dir/#findComment-414942
Share on other sites

that is very simple. Although i dont use an array. I just run thorough loop

 

This is how i do it

 

<?php
$ImageDirectory = "../upload/pictures/thumbnail";
?>
<html>
<body>
<form action="delete.php" method="post">
<?php
$BigImage = "../upload/pictures/picture";
foreach (glob("$ImageDirectory/{*.gif,*.jpg,*.png,*.GIF,*.JPG,*.PNG}", GLOB_BRACE) as $image)
{




//remove .. for url
$dir = str_replace("..", "", "$BigImage");

//get name for url
$name = str_replace("$ImageDirectory", "", "$image");

//get name on it's own
$fullname = str_replace("/", "", $name);
echo '<br />';
echo $fullname;
echo '<br />';
echo '<img src="'.$image.'">';
echo '<br />';
echo "www.adamplowman.co.uk".$dir.$name;
echo '<br />';
echo "<a href=\"http://www.cycloxchamps.co.uk\admin".$dir.$name."\">View full Image</a>";
echo '<br />';
echo '<input type="radio" name="delete[]" value="'.$image.'" />Delete '.$image;
echo '<br />';
echo '<br />';
echo '<input type="submit" value="Delete Selected">';
echo '<br />';
echo '<br />';
}
?>
</from>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/81693-open-dir/#findComment-414945
Share on other sites

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.