/************************************************/
/* Crea: DNG 2005/12/12 */
/* Descr: Upload a photo album */
/************************************************/
require_once('cImageresize.php');
$message = "";
$imagedir = "images/";
$filelisthtml = "";
// Refresh of the data
if (isset($_POST)){
if(!empty($_POST['action'])) $action = $_POST['action']; else $action = 0;
if(!empty($_POST['picturename'])) $picturename = $_POST['picturename']; else $picturename = "";
}
// Infos sur l'image
if(isset($_FILES['myphoto'])) {
$nom_fichier = $_FILES['myphoto']['name'];
$taille = $_FILES['myphoto']['size']; // taille en octect, sinon il faut diviser par 1000
$tmp = $_FILES['myphoto']['tmp_name'];
} else {
$nom_fichier = "";
$taille = ""; // taille en octect, sinon il faut diviser par 1000
$tmp = "";
}
// Parcourir le répertoire
if(is_dir($imagedir)){
$dir = opendir($imagedir);
} else {
mkdir($imagedir, 2755);
$dir = opendir($imagedir);
}
while ($fileslist = readdir($dir)) {
if(is_file($imagedir.$fileslist)) {
$filelisthtml .= "".$fileslist."
";
}
}
if($action) {
$filepath = "images/".$picturename;
$newfilename = "sm_".$picturename;
if(is_file($filepath)) {
$img_obj = new cImageresize($filepath, $newfilename);
// $img_obj->crop();
$img_obj->thumb(500);
$img_obj->imageclose("images/donny", "image/gif");
$message = "OK c'est bon.";
} else {
$message = "Please contact the administrator: webmaster@verymeet.com";
}
}
?>
| Upload the image |
| Infos sur le fichier: |