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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.