- Fichier HTML "Index.htm"
-
- <HTML>
-
- <HEAD>
- <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
- <TITLE>CLIPART</TITLE>
- </HEAD>
-
- <frameset framespacing="0" cols="214,*">
- <frame name="gauche" scrolling="yes" target="haut_droite" src="MenuRapide.php">
- <frame name="droite" src="vide.htm" SCROLLING="auto">
- <noframes>
- <body>
-
- <p>Cette page utilise des cadres, mais votre navigateur ne les prend pas en
- charge.</p>
-
- </body>
- </noframes>
- </frameset>
- </HTML>
-
- Le fichier "Vide.htm" :
-
- <HTML>
- <BODY>
- </BODY>
- </HTML>
-
- (et oui il est vide :)
-
- Le fichier "MenuRapide.php" :
-
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
- <title>Copie</title>
- </head>
-
- <body>
- <font size=1>
- <?php
- function QuickMenu ($dir)
- {
- $thisdir = opendir($dir);
-
- while ($item = readdir($thisdir))
- {
- if (is_dir("$dir/$item") && (substr("$item", 0, 1) != '.') && (substr("$item",0,1)!='_') && (strcmp("$item","Temp")!=0))
- {
- print "<li><a href=\"$dir/$item/main.php\" target=\"droite\">";
- $niv=Niveau("$dir/$item");
- for ($i=0;$i<=$niv;$i++)
- print " ";
- if ($niv==2 || $niv==1)
- print "<font color=\"#FF0000\">";
- print $item."</a></li>";
- if ($niv==2 || $niv==1)
- print "</font>";
- QuickMenu ("$dir/$item");
- }
- }
- }
- Function Niveau($Nom)
- {
- $nb=0;
- for ($i=0;$i<=strlen($Nom);$i++)
- if(substr($Nom, $i, 1)=='/')
- $nb++;
-
- return $nb;
- }
- ?>
- <ul>
- <?
- QuickMenu (".."); // Chemin d'accès ...
- ?>
- </ul>
- </font>
- </body>
- </html>
-
- Le fichier main.php a mettre dans chaque dossier où se trouvent les images :
-
- <html>
- <head><title>CLIPART
- </title>
- </head>
- <body>
-
- <h2><B>CLIPART</B></h2><BR>
-
- <?php
- $dir = dirname(".");
- echo "<center><table>";
- $n=0;
- if (is_dir($dir))
- {
- if ($dh = opendir($dir))
- {
- while (($file = readdir($dh)) !== false)
- {
- $extension = strrchr($file,".");
- $longueur = strlen($file)-strlen($extension);
- $ext = strtolower(substr($file,$longueur +1,strlen($extension)));
- $taille_image = @getimagesize($file);
- if(($ext=="gif") || ($ext=="jpg") || ($ext=="wmf") || ($ext=="bmp"))
- {
- print "<td><center>";
- print "<a href=\"".$file."\">".$file."<br>";
- if(is_file($dir . $file)){
- print " Taille : ".floor((filesize(trim($dir . $file)))/1024)." Ko (";
- print "\n$taille_image[0]*$taille_image[1])";
- }
- if ($taille_image[0]==0) $taille_image[0]=100;
-
- $x=100/$taille_image[0]; // calcul du ratio de réduction
- if ($x==0) $x=1;
- $y=66*$x;
- //print "<center><img border=0 src=\"".realpath($dir)."\\".$file."\" width=100 height=$y align=\"absmiddle\"></center>"; print "</a> ";
- print "<center><img border=0 src=\"".$file."\" width=100 height=$y align=\"absmiddle\"></center>";
- print "</a> ";
- print "</center></td>";
- $n++;
- if(($n)==1)
- {
- print "<tr>";
- }
- if($n>3)
- {
- print "</tr>";
- $n=1;
- }
- }
- }
- closedir($dh);
- }
- }
- print "</table></center>";
-
- ?>
- </body>
- </html>
-
- Si vous avez comme moi plus de 4000 répertoires où écrire le fichier main.php, vici un autre script, que j'ai adapté à mes besoin et qui provient du site : http://fr3.php.net/manual/fr/
-
-
-
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
- <title>Copie</title>
- </head>
-
- <body>
- <?php
- function copyintodir ($file, $dir, $skip = array(''), $level_count = 0) {
- if (count($skip) == 1) {
- $skip = array("$skip");
- }
- if (!@($thisdir = opendir($dir))) {
- print "could not open $dir<br />";
- return;
- }
- while ($item = readdir($thisdir) ) {
- if (is_dir("$dir/$item") && (substr("$item", 0, 1) != '.') && (!in_array($item, $skip))) {
- copyintodir($file, "$dir/$item", $skip, $level_count + 1);
- }
- }
- if ($level_count > 0)
- if (@copy($file, "$dir/$file")) {
- print "Copied $file into $dir/$file<br />\n";
- } else {
- print "Could not copy $file into $dir/$file<br />\n";
- }
- }
-
- //copyintodir ('index.php', '.', 'images');
-
- copyintodir ("main.php", "../..","");
-
- ?>
- </body>
- </html>
-
-
-
Fichier HTML "Index.htm"
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<TITLE>CLIPART</TITLE>
</HEAD>
<frameset framespacing="0" cols="214,*">
<frame name="gauche" scrolling="yes" target="haut_droite" src="MenuRapide.php">
<frame name="droite" src="vide.htm" SCROLLING="auto">
<noframes>
<body>
<p>Cette page utilise des cadres, mais votre navigateur ne les prend pas en
charge.</p>
</body>
</noframes>
</frameset>
</HTML>
Le fichier "Vide.htm" :
<HTML>
<BODY>
</BODY>
</HTML>
(et oui il est vide :)
Le fichier "MenuRapide.php" :
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Copie</title>
</head>
<body>
<font size=1>
<?php
function QuickMenu ($dir)
{
$thisdir = opendir($dir);
while ($item = readdir($thisdir))
{
if (is_dir("$dir/$item") && (substr("$item", 0, 1) != '.') && (substr("$item",0,1)!='_') && (strcmp("$item","Temp")!=0))
{
print "<li><a href=\"$dir/$item/main.php\" target=\"droite\">";
$niv=Niveau("$dir/$item");
for ($i=0;$i<=$niv;$i++)
print " ";
if ($niv==2 || $niv==1)
print "<font color=\"#FF0000\">";
print $item."</a></li>";
if ($niv==2 || $niv==1)
print "</font>";
QuickMenu ("$dir/$item");
}
}
}
Function Niveau($Nom)
{
$nb=0;
for ($i=0;$i<=strlen($Nom);$i++)
if(substr($Nom, $i, 1)=='/')
$nb++;
return $nb;
}
?>
<ul>
<?
QuickMenu (".."); // Chemin d'accès ...
?>
</ul>
</font>
</body>
</html>
Le fichier main.php a mettre dans chaque dossier où se trouvent les images :
<html>
<head><title>CLIPART
</title>
</head>
<body>
<h2><B>CLIPART</B></h2><BR>
<?php
$dir = dirname(".");
echo "<center><table>";
$n=0;
if (is_dir($dir))
{
if ($dh = opendir($dir))
{
while (($file = readdir($dh)) !== false)
{
$extension = strrchr($file,".");
$longueur = strlen($file)-strlen($extension);
$ext = strtolower(substr($file,$longueur +1,strlen($extension)));
$taille_image = @getimagesize($file);
if(($ext=="gif") || ($ext=="jpg") || ($ext=="wmf") || ($ext=="bmp"))
{
print "<td><center>";
print "<a href=\"".$file."\">".$file."<br>";
if(is_file($dir . $file)){
print " Taille : ".floor((filesize(trim($dir . $file)))/1024)." Ko (";
print "\n$taille_image[0]*$taille_image[1])";
}
if ($taille_image[0]==0) $taille_image[0]=100;
$x=100/$taille_image[0]; // calcul du ratio de réduction
if ($x==0) $x=1;
$y=66*$x;
//print "<center><img border=0 src=\"".realpath($dir)."\\".$file."\" width=100 height=$y align=\"absmiddle\"></center>"; print "</a> ";
print "<center><img border=0 src=\"".$file."\" width=100 height=$y align=\"absmiddle\"></center>";
print "</a> ";
print "</center></td>";
$n++;
if(($n)==1)
{
print "<tr>";
}
if($n>3)
{
print "</tr>";
$n=1;
}
}
}
closedir($dh);
}
}
print "</table></center>";
?>
</body>
</html>
Si vous avez comme moi plus de 4000 répertoires où écrire le fichier main.php, vici un autre script, que j'ai adapté à mes besoin et qui provient du site : http://fr3.php.net/manual/fr/
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Copie</title>
</head>
<body>
<?php
function copyintodir ($file, $dir, $skip = array(''), $level_count = 0) {
if (count($skip) == 1) {
$skip = array("$skip");
}
if (!@($thisdir = opendir($dir))) {
print "could not open $dir<br />";
return;
}
while ($item = readdir($thisdir) ) {
if (is_dir("$dir/$item") && (substr("$item", 0, 1) != '.') && (!in_array($item, $skip))) {
copyintodir($file, "$dir/$item", $skip, $level_count + 1);
}
}
if ($level_count > 0)
if (@copy($file, "$dir/$file")) {
print "Copied $file into $dir/$file<br />\n";
} else {
print "Could not copy $file into $dir/$file<br />\n";
}
}
//copyintodir ('index.php', '.', 'images');
copyintodir ("main.php", "../..","");
?>
</body>
</html>