Greenguy's Board


Go Back   Greenguy's Board > General Business Knowledge
Register FAQ Calendar Today's Posts

 
 
Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
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
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:30 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc