Jump to content

help with directory included in string?


wmguk

Recommended Posts

hey guys,

 

I am using a thumbnail script and it gets the images from a directory, the images are found in ../../clients/$dir but i dont want to show the directory structure, in the images name so how can i specify the directory with out making the structure part of the name?

 

$dir = $_GET['login'];
$pricing = $_GET['pricing'];
$NBFile=0;
$dir ="../../clients/$dir";
if ($handle = opendir($dir)) {
    while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != "..") {
        //if (substr($file, strlen($file)-3, 3)=="jpg" ) {
            $FileArray[] = $dir."/".$file;
            $NBFile=$NBFile+1;
        //}

        }
    }
}
closedir($handle);

 

any ideas?

 

Cheers

Drew

Link to comment
Share on other sites

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
    $dir = $_GET['login'];
    $pricing = $_GET['pricing'];
$NBFile=0;
$dir ="../../clients/$dir";
if ($handle = opendir($dir)) {
    while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != "..") {
        //if (substr($file, strlen($file)-3, 3)=="jpg" ) {
            $FileArray[] = $dir."/".$file;
            $NBFile=$NBFile+1;
        //}

        }
    }
}
closedir($handle);
?><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
}
.image{
    border-style:outset;
    border-color: black;
    border-width:1px;
      }
</style>
</head>
<body><table align="center"><tr>
<?php
$NBPicswidth=1;
$NBPics=0;
for ($i=0; $i<$NBFile; $i++) {
$Pic_Name1=$FileArray[$i];
?><td class="image">
  <a href="dis.php?image=<?php echo $Pic_Name1; ?>&pricing=<?php echo $pricing; ?>" target="order"><img src="<?php echo $Pic_Name1; ?>" width="100" border="0" align="top"></a>
</td></tr><?php
$NBPics=$NBPics+1;

if ( $NBPics==$NBPicswidth ) { $NBPics=0; ?>
<?php }
}
?></table>
</body>
</html> 

 

is there anyway to just see the image name in this script?

Link to comment
Share on other sites

  • 1 month later...

I want to assign a new variable ie $imagename to this, so I can see the image but also have the name without the path,

 

<?php
    $dir = $_GET['login'];
    $pricing = $_GET['pricing'];
$NBFile=0;
$dir ="../../clients/$dir";
if ($handle = opendir($dir)) {
    while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != "..") {
        //if (substr($file, strlen($file)-3, 3)=="jpg" ) {
            $FileArray[] = $dir."/".$file;
            $NBFile=$NBFile+1;
        //}

        }
    }
}
closedir($handle);
?>

 

I dont seem to be able to add a second array just displaying the $file information

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.