View Single Post
Old 2008-01-31, 03:25 PM   #12
Mateusz
Screw you, guys. I'm going home.
 
Mateusz's Avatar
 
Join Date: Mar 2004
Location: Gliwice, Poland
Posts: 996
Send a message via ICQ to Mateusz
You can use this easy php script as well - its usefull if you already have your photos already on server so you dont need to download and upload them again.

As for now it looks for the pics in directory where the script file is located and copy resized pics to directory called 'tn' (assuming its already created), but you can modify it to check all subdirectories by adding several lines

PHP Code:
<?php



if ($_POST[send] == 'ok') {


$desc_directory 'tn';

foreach( 
glob('*.jpg') as $plik )
   {
    
$tablica[] = basename($plik);
      }
     
    for( 
$x 0$x count($tablica); $x++ )

        {
      

          
$img ImageCreateFromJpeg("$tablica[$x]");        

          
$filename "$tablica[$x]";
                    
          
$x5 imagesx($img);
          
$y5 imagesy($img);
                   
               if(
$x5 $y5){
             
$nx5 $_POST[wielkosc];
             
$ny5 $_POST[wielkosc]* ($y5 $x5);
               }

          elseif(
$x5 $y5){
             
$nx5 $_POST[wielkosc]* ($x5 $y5);
              
$ny5 $_POST[wielkosc];
               }

          else{
              
$nx5 $_POST[wielkosc];
             
$ny5 $_POST[wielkosc];
              }

                                        
          
$new_img imagecreatetruecolor($nx5$ny5);
          
imagecopyresampled($new_img$img0000$nx5$ny5$x5$y5);
                    
          
imagejpeg($new_img"$desc_directory/$filename"85);
    
    
         }






}

else {


echo 
'<form method="post" action="resize_pics.php">
NEW SIZE:<input type="texy" size="32" name="wielkosc" value=""><br>
<input type="submit" name="send" value="ok"></form>'
;

}





?>
imagejpeg($new_img, "$desc_directory/$filename", 85);
- 85 is the quality factor (0-100)


*****

UPS, I didn't notice your already done

Last edited by Mateusz; 2008-01-31 at 03:34 PM..
Mateusz is offline   Reply With Quote