- // voici le code du fichier des fonctions
-
- <?php
-
- function createthumb($name,$filename, $thumb_x, $thumb_y, $caption)
- {
- if (!file_exists($filename)){
- $img_in = imagecreatefromjpeg($name);
- $img_out = imagecreatetruecolor($thumb_x, $thumb_y);
- $tc = str_replace(".//","",$img);
- imagecopyresampled($img_out, $img_in, 0, 0, 0, 0, imagesx($img_out), imagesy($img_out), imagesx($img_in), imagesy($img_in));
- $white = imagecolorallocate($img_out, 255, 255, 255);
- $black = imagecolorallocate($img_out, 0, 0, 0);
- //imagestring($img_out,1,3,3,$caption,$black);
- //imagestring($img_out,1,2,2,$caption,$white);
- imagejpeg($img_out, $filename, 100);
- imagedestroy($img_out);
- imagedestroy($img_in);
- }
- }
-
- function createDir($from, $to) {
- $dossier=opendir($from);
- while ($fichier = readdir($dossier)) {
- $l = array('.', '..');
- if (!in_array( $fichier, $l)){
- if (is_dir($from."/".$fichier)){
- if (!file_exists($to."/".$fichier)){
- mkdir($to."/".$fichier, 0777);
- chmod($to."/".$fichier."/", 0777);
- }
- createDir($from."/".$fichier,$to."/".$fichier);
- }
- }
- }
- }
-
- function generate($fullsized , $thumbs){
- $thumb_x = "128"; // Horizontal size of thumbnail created in pixels
- $thumb_y = "96"; // Vertical size of thumbnail created in pixels
- $dossier=opendir($fullsized);
- while ($fichier = readdir($dossier)) {
- $l = array('.', '..','Thumbs.db');
- if (!in_array( $fichier, $l)){
- $tmp = $thumbs."/".$fichier;
- $tmp2 = $fullsized."/".$fichier;
- $tmpd = ereg_replace("images/","",$tmp2);
-
- if (is_dir($fullsized."/".$fichier)){
- print("
- <a href=\"?d=$tmpd&id=$id\" class=\"liens\">$fichier</a><br>
- ");
- } else {
- $img_nfo = getimagesize($fullsized."/".$fichier);
- createthumb($fullsized."/".$fichier,$thumbs."/".$fichier, $thumb_x, $thumb_y, $caption);
- $url = "javascript:showimage('big.php?show=$fullsized/$fichier','$img_nfo[0]','$img_nfo[1]')";
- print("
- <a href=\"$url\"><img border=0 src=\"$tmp\"></a>
- ");
- }
- }
- }
- }
- ?>
// voici le code du fichier des fonctions
<?php
function createthumb($name,$filename, $thumb_x, $thumb_y, $caption)
{
if (!file_exists($filename)){
$img_in = imagecreatefromjpeg($name);
$img_out = imagecreatetruecolor($thumb_x, $thumb_y);
$tc = str_replace(".//","",$img);
imagecopyresampled($img_out, $img_in, 0, 0, 0, 0, imagesx($img_out), imagesy($img_out), imagesx($img_in), imagesy($img_in));
$white = imagecolorallocate($img_out, 255, 255, 255);
$black = imagecolorallocate($img_out, 0, 0, 0);
//imagestring($img_out,1,3,3,$caption,$black);
//imagestring($img_out,1,2,2,$caption,$white);
imagejpeg($img_out, $filename, 100);
imagedestroy($img_out);
imagedestroy($img_in);
}
}
function createDir($from, $to) {
$dossier=opendir($from);
while ($fichier = readdir($dossier)) {
$l = array('.', '..');
if (!in_array( $fichier, $l)){
if (is_dir($from."/".$fichier)){
if (!file_exists($to."/".$fichier)){
mkdir($to."/".$fichier, 0777);
chmod($to."/".$fichier."/", 0777);
}
createDir($from."/".$fichier,$to."/".$fichier);
}
}
}
}
function generate($fullsized , $thumbs){
$thumb_x = "128"; // Horizontal size of thumbnail created in pixels
$thumb_y = "96"; // Vertical size of thumbnail created in pixels
$dossier=opendir($fullsized);
while ($fichier = readdir($dossier)) {
$l = array('.', '..','Thumbs.db');
if (!in_array( $fichier, $l)){
$tmp = $thumbs."/".$fichier;
$tmp2 = $fullsized."/".$fichier;
$tmpd = ereg_replace("images/","",$tmp2);
if (is_dir($fullsized."/".$fichier)){
print("
<a href=\"?d=$tmpd&id=$id\" class=\"liens\">$fichier</a><br>
");
} else {
$img_nfo = getimagesize($fullsized."/".$fichier);
createthumb($fullsized."/".$fichier,$thumbs."/".$fichier, $thumb_x, $thumb_y, $caption);
$url = "javascript:showimage('big.php?show=$fullsized/$fichier','$img_nfo[0]','$img_nfo[1]')";
print("
<a href=\"$url\"><img border=0 src=\"$tmp\"></a>
");
}
}
}
}
?>