Просмотр файла script/admin/resize.php

Размер файла: 2.2Kb
<?php
/*-----------------------------------------------------------------------------------------
mcGalleryPRO
All code is © 2003 Marc Cagninacci.
No files may be redistributed in whole or significant part.
----------------- mcgalleryPRO IS NOT FREE SOFTWARE -------------------
You should have receive a file called license.txt in this package
--------------------------------------------------------------------------------------------*/

session_start();
if (empty($_SESSION['private_login']))
{
include "./sess.php";
exit;
}
include './conf.inc.php';
include './header.php';

if ($dir!='')
{
$dir='../photos/'.$dir;
$handle=opendir($dir);
$i=0;
while ($file = readdir($handle))
 {
  if ($file != "." && $file != ".." && $file != "small" && $file != "big" && $file != "Thumbs.db" && $file != "index.php" && $file != "_vti_cnf" && $file != "_vti_pvt" && $file != "_vti_script" && $file != "_vti_txt")
  {
$fichier = $dir.'/'.$file;
   if (!file_exists($dir.'/small/'.$file))
   {
$ext = strrchr($fichier,'.');
if ($ext == '.jpg' || $ext == '.JPG')  $image = ImageCreateFromJPEG($fichier);
elseif ($ext == '.png' || $ext == '.PNG')  $image = ImageCreateFromPNG($fichier);

$width = imagesx($image) ;
$height = imagesy($image) ;

$new_width = $thumb_width;
$new_height = ($new_width * $height) / $width ;

if ($gd_ver == 1) 
{  
 $thumb = imagecreate($new_width,$new_height); 
 imagecopyresized($thumb,$image,0,0,0,0,$new_width,$new_height,$width,$height);
}
elseif ($gd_ver == 2) 
{ 
 $thumb = imagecreatetruecolor($new_width,$new_height); 
 imagecopyresampled($thumb,$image,0,0,0,0,$new_width,$new_height,$width,$height);
}

if ($ext == '.jpg' || $ext == '.JPG')  ImageJPEG($thumb, $dir.'/small/'.$file);
elseif ($ext == '.png' || $ext == '.PNG') ImagePNG($thumb, $dir.'/small/'.$file);
imagedestroy($image);

echo '<div align="center"><font face="verdana" size="1" color="black">';
echo $l_Thumb.' '.$file.': ok</font></div><br>';

$i++;
   }
  }
 }
echo '<div align="center"><font face="verdana" size="1" color="black">';
echo $i.' '.$l_thumbs_ok.'</font><br><br>';
echo '<a href="index.php?start='.$start.'" class="lien1"><b>'.$l_Retour.'</b></a>';
}
include './footer.php';
?>