Advertisement
beeradmoore

Untitled

Jul 16th, 2013
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. <?php
  2.     include 'SimpleImage.class.php';
  3.                    
  4.     $image = new SimpleImage();            
  5.     $image->load($_FILES['imageFile']['tmp_name']);
  6.     // Fixes EXIF rotation data.               
  7.     $image = $image->auto_orient();
  8.  
  9.     // Dimension, not filesize.        
  10.     $maxImageSize = 1024;
  11.        
  12.     if ($image->get_width() > $maxImageSize || $image->get_height() > $maxImageSize)
  13.     {
  14.         $image = $image->best_fit($maxImageSize, $maxImageSize);
  15.     }
  16.    
  17.     // Temp save original image.
  18.     $image->save($_FILES["imageFile"]["tmp_name"].'_o', 100);
  19.    
  20.     if ($image->get_width() > 600)
  21.     {
  22.         // Save thumbnail.
  23.         $image->fit_to_width(600)->save('upload/'.basename($_FILES["imageFile"]["name"]).'_600.jpg', 100);
  24.     }
  25.    
  26.    
  27.     // Save small thumbnail.
  28.     $image->square_crop(60)->save('upload/'.$_FILES["imageFile"]["tmp_name"].'_st.jpg', 75);
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement