print 'Error wrong mode - only h,w,a,c'; exit; } if ($size == '') { print 'Error size is no INTEGER'; exit; } if ($size > $REX['ADDON']['max_size'][$mypage]) { print 'Error size to big: max ' . $REX['ADDON']['max_size'][$mypage] . ' px'; exit; } // start thumb class $thumb = new thumbnail($imagepath); // check method if ($mode == 'w') { $thumb->size_width($size); } if ($mode == 'h') { $thumb->size_height($size); } if ($mode == 'c') { $thumb->size_crop($size, $hmode); } elseif ($hmode != '') { $thumb->size_height($hmode); } if ($mode == 'a') { $thumb->size_auto($size); } foreach ($rex_filter as $filter) { $thumb->addFilter($filter); }
public function addCover($field, $dir = false) { global $settings; if (!$dir) { global $coverpath; $dir = $coverpath; } $bestand = $dir . $this->id . ".jpg"; // Is it jpg or png? $extentie = strtolower(findExtention($_FILES[$field]["name"])); if ($extentie != "jpg") { return false; } // Remove old file if (file_exists($bestand)) { unlink($bestand); } // Copy copy($_FILES[$field]["tmp_name"], $bestand); // Thumbnail $thumb = new thumbnail($bestand); $thumb->size_width($settings["photo"]["tn_maxwidth"]); $thumb->jpeg_quality(100); $thumb->save($dir . "tn_" . $this->id . ".jpg"); }
echo "<SCRIPT language=\"javascript\">"; echo "alert('Erreur lors de la connexion א la base de donnיes. Vous serez ramenי א la page d'acceuil.');"; echo "top.location.href=\"/interPool/index.php\";"; echo "</SCRIPT>"; exit; } $id_saison = $sess->getSessVar('id_saison', '0'); $journalDir = "/export/home/www/interPool/images/journal/{$poolName}"; $thumbnailDir = $journalDir . "/thumbnails"; // tout d'un coup que le bouton send a יtי appuyי sans uploader de fichier... if ($_FILES['file2upload']['tmp_name'] == "") { echo "<SCRIPT language=\"javascript\">"; echo "window.location.href=\"/interPool/src/admin.php\";"; echo "</SCRIPT>"; exit; } // dיplacer le fichier uploadי dans le bon rיpertoire $uploadfile = $journalDir . "/" . basename($_FILES['file2upload']['name']); if (move_uploaded_file($_FILES['file2upload']['tmp_name'], $uploadfile)) { // crיation du thumbnail $thumbFile = $thumbnailDir . "/" . basename($_FILES['file2upload']['name']); $thumb = new thumbnail($uploadfile); $thumb->size_width(150); $thumb->size_height(200); $thumb->save($thumbFile); $query = "update accounts_detail set journal_vu='N'\n\t where id_pool = {$id_pool}\n\t and saison_id = {$id_saison}"; mysql_query($query, $pool->handle); } echo "<SCRIPT language=\"javascript\">"; echo "window.location.href=\"/interPool/src/admin.php\";"; echo "</SCRIPT>";
$fileTypes = array('jpg', 'jpeg', 'gif', 'png'); // File extensions $fileParts = pathinfo($_FILES['Filedata']['name']); $image_ext = $fileParts['extension']; // Getting the image extention $image_name = basename($_FILES['Filedata']['name']); // Getting the image name // Generating a unique image path $image_path = md5(rand() * time()) . md5($image_name) . "." . $image_ext; // Generating a unique thumb image path $thumb_image_path = "thumb_" . $image_path; // Complete image path $targetFile = rtrim($targetPath, '/') . '/' . $image_path; // Complete thumb image path $thumbTargetFile = rtrim($targetPath, '/') . '/' . $thumb_image_path; $complete_image_path = $targetFolder . $image_path; $complete_thumb_path = $targetFolder . $thumb_image_path; if (in_array($image_ext, $fileTypes)) { copy($tempFile, $targetFile); //move_uploaded_file($tempFile,$targetFile); $thumb = new thumbnail($targetFile); $thumb->size_width(400); $thumb->size_height(300); $thumb->jpeg_quality(100); $thumb->save($thumbTargetFile); $query_obj->add_image($complete_thumb_path, $complete_image_path, "", 1, $dateTime, 1, $dateTime); echo '1'; } else { echo 'Invalid file type.'; } }