Jump to content

[SOLVED] Can my thumbnail script display in order of 001 - 099


wmguk

Recommended Posts

Hi,

 

This is a script i have to make thumbnails but it doesnt display them in any order...

 

Can i make it find the lowest to highest?

 

its in use in sever different folders of images...

One folder has images like: KM-125-21-XXXX.jpg and other folders are simply XXXX.jpg

 

Code on top of page:

 

<?php
$dir = $_GET['login'];
$NBFile=0;
$dir ="$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);
?>

 

Code in HTML

<?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; ?>" target="order"><img src="<?php echo $Pic_Name1; ?>" height="150" border="0" align="top"></a>
</td><?php
$NBPics=$NBPics+1;

if ( $NBPics==$NBPicswidth ) { $NBPics=0; ?>
<?php }
}
?>

  • 2 weeks later...

Hi,

 

I tried several sort() codes, but none work....

 

can someone help please?

 

<?php
$NBPicswidth=1;
$NBPics=0;
for ($i=0; $i<$NBFile; $i++) {
$Pic_Name2=$FileArray[$i];
$Pic_Name1= sort($Pic_Name2);
?>

//I ALSO TRIED

<?php
$NBPicswidth=1;
$NBPics=0;
for ($i=0; $i<$NBFile; $i++) {
$Pic_Name1=sort($FileArray[$i]);
?>

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

        }
    }
}
closedir($handle);

sort ($FileArray);

foreach ($FileArray as $filename) {
    echo "$filename <br />";
}

  • 2 months later...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<?php
$dir = $_GET['login'];
$NBFile=0;
$dir ="$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];
//$Pic_Name1= sort($Pic_Name2);
?>

<td class="image">

  <a href="dis.php?image=<?php echo $Pic_Name1; ?>" target="order"><img src="<?php echo $Pic_Name1; ?>" height="150" border="0" align="top"></a>

</td>

<?php
$NBPics=$NBPics+1;

if ( $NBPics==$NBPicswidth ) { $NBPics=0;
}
}
?>

</table>

</body>

</html>

 

oh sorry, I didnt know how to write it for you...

 

it just white screens... nothing appears at all

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
$dir = $_GET['login'];
$NBFile=0;
$dir ="$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];
//$Pic_Name1= sort($Pic_Name2);
?><td class="image">
  <a href="dis.php?image=<?php echo $Pic_Name1; ?>" target="order"><img src="<?php echo $Pic_Name1; ?>" height="150" border="0" align="top"></a>
</td><?php
$NBPics=$NBPics+1;

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

  • 2 weeks later...

hey,

 

I now have a page simply saying:

 

<?php
ini_set('display_errors', 1); 
error_reporting(E_ALL);

$dir = $_GET['login'];
$NBFile=0;
$dir ="$dir";
if ($handle = opendir($dir)) {
    while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != "..") {
            [] = $dir."/".$file;
            $NBFile=$NBFile+1;
        }
    }
}
closedir($handle);

sort ($FileArray);

foreach ($FileArray as $filename) {
    echo "$filename <br />";
}
?>

 

and its blank but if i view source i get:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content=UUAOAYIPOH name=SKYPE_FRAMEID></HEAD>
<BODY></BODY></HTML>

 

so still nothing makes sense..

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.