par
lelapinou » 03 oct. 2005, 13:03
Bonjour,
je viens d'acheter un espace web (surftown.fr).
J'ai un soucis avec mon site, ce que le script de démarrage (qui crée des miniatures, et copie des fichiers de répertoire à répertoire) ne s'éxécute pas. Leur service technique me dit que c peut être à cause de leur Safe_mode = On, alors j'aimerais savoir si c vrai.
voici mon fichier, il se compose de 4 fonctions qui créent des répertoires, créent des miniatures, et copient des fichiers :
<?php
//function createthumb($name,$filename, $thumb_x, $thumb_y, $caption)
function createthumb($name,$filename, $thumb_x, $thumb_y)
{
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)
{
if ($dossier=opendir($from))
{
while ($fichier = readdir($dossier))
{
$l = array('.', '..');
if (!in_array( $fichier, $l))
{
if (is_dir($from.$fichier))
{
if (!file_exists($from.$fichier."/thumbnail"))
{
mkdir($from.$fichier."/thumbnail", 0777);
chmod($from.$fichier."/thumbnail/", 0777);
mkdir($from.$fichier."/comments", 0777);
chmod($from.$fichier."/comments/", 0777);
}
createDir($from.$fichier);
}
}
}
}
else
{
print($from." n'a pas pu etre ouvert");
}
}
function generate($fullsized)
{
$thumb_x = "128"; // Horizontal size of thumbnail created in pixels
$thumb_y = "96"; // Vertical size of thumbnail created in pixels
if ($dossier1=opendir($fullsized))
{
while ($fichier1 = readdir($dossier1))
{
$l = array('.', '..','thumbnail','comments','conf.php','index.php','gal.gif','back.png','next.png','home.gif','Thumbs.db','thumbnail.php','images.css','affiche.php');
if (!in_array( $fichier1, $l))
{
if (!is_dir($fullsized.$fichier1))
{
if (!file_exists($fullsized."/thumbnail/".$fichier1))
{
$img_nfo = getimagesize($fullsized."/".$fichier1);
createthumb($fullsized."/".$fichier1,$fullsized."/thumbnail/".$fichier1, $thumb_x, $thumb_y);
createthumb($fullsized."/".$fichier1,$fullsized."/thumbnail/".$fichier1, $thumb_x, $thumb_y);
}
}
else
{
generate($fullsized.$fichier1);
}
}
}
}
else
{
print($from." n'a pas pu etre ouvert");
}
}
function CopyBase($from)
{
$m = array('add.php','add2.php');
$n = array('conf.php','index.php','gal.gif','back.png','next.png','home.gif','images.css','thumbnail.php','affiche.php');
if ($dossier=opendir($from))
{
while ($fichier = readdir($dossier))
{
$l = array('.', '..');
if (!in_array( $fichier, $l))
{
if (is_dir($from.$fichier))
{
if ($Base = opendir("Base/"))
{
while ($file = readdir($Base))
{
$k = array('.','..');
if (!in_array($file,$k))
{
if (in_array($file,$m))
{
copy("Base/".$file,$from.$fichier."/comments/".$file);
}
if (in_array($file,$n))
{
copy("Base/".$file,$from.$fichier."/".$file);
}
}
}
}
}
}
}
}
}
?>
Merci de votre aide

Bonjour,
je viens d'acheter un espace web (surftown.fr).
J'ai un soucis avec mon site, ce que le script de démarrage (qui crée des miniatures, et copie des fichiers de répertoire à répertoire) ne s'éxécute pas. Leur service technique me dit que c peut être à cause de leur Safe_mode = On, alors j'aimerais savoir si c vrai.
voici mon fichier, il se compose de 4 fonctions qui créent des répertoires, créent des miniatures, et copient des fichiers :
[php]<?php
//function createthumb($name,$filename, $thumb_x, $thumb_y, $caption)
function createthumb($name,$filename, $thumb_x, $thumb_y)
{
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)
{
if ($dossier=opendir($from))
{
while ($fichier = readdir($dossier))
{
$l = array('.', '..');
if (!in_array( $fichier, $l))
{
if (is_dir($from.$fichier))
{
if (!file_exists($from.$fichier."/thumbnail"))
{
mkdir($from.$fichier."/thumbnail", 0777);
chmod($from.$fichier."/thumbnail/", 0777);
mkdir($from.$fichier."/comments", 0777);
chmod($from.$fichier."/comments/", 0777);
}
createDir($from.$fichier);
}
}
}
}
else
{
print($from." n'a pas pu etre ouvert");
}
}
function generate($fullsized)
{
$thumb_x = "128"; // Horizontal size of thumbnail created in pixels
$thumb_y = "96"; // Vertical size of thumbnail created in pixels
if ($dossier1=opendir($fullsized))
{
while ($fichier1 = readdir($dossier1))
{
$l = array('.', '..','thumbnail','comments','conf.php','index.php','gal.gif','back.png','next.png','home.gif','Thumbs.db','thumbnail.php','images.css','affiche.php');
if (!in_array( $fichier1, $l))
{
if (!is_dir($fullsized.$fichier1))
{
if (!file_exists($fullsized."/thumbnail/".$fichier1))
{
$img_nfo = getimagesize($fullsized."/".$fichier1);
createthumb($fullsized."/".$fichier1,$fullsized."/thumbnail/".$fichier1, $thumb_x, $thumb_y);
createthumb($fullsized."/".$fichier1,$fullsized."/thumbnail/".$fichier1, $thumb_x, $thumb_y);
}
}
else
{
generate($fullsized.$fichier1);
}
}
}
}
else
{
print($from." n'a pas pu etre ouvert");
}
}
function CopyBase($from)
{
$m = array('add.php','add2.php');
$n = array('conf.php','index.php','gal.gif','back.png','next.png','home.gif','images.css','thumbnail.php','affiche.php');
if ($dossier=opendir($from))
{
while ($fichier = readdir($dossier))
{
$l = array('.', '..');
if (!in_array( $fichier, $l))
{
if (is_dir($from.$fichier))
{
if ($Base = opendir("Base/"))
{
while ($file = readdir($Base))
{
$k = array('.','..');
if (!in_array($file,$k))
{
if (in_array($file,$m))
{
copy("Base/".$file,$from.$fichier."/comments/".$file);
}
if (in_array($file,$n))
{
copy("Base/".$file,$from.$fichier."/".$file);
}
}
}
}
}
}
}
}
}
?>[/php]
Merci de votre aide :oops: