View Single Post
Old 2018-02-07, 10:47 PM   #2
sarettah
Asleep at the switch? I wasn't asleep, I was drunk
 
Join Date: Apr 2005
Posts: 214
And here is the usage of it:

Code:
<?php

  require_once('optimize_images_class.php');

  // create class
  $new_page=new sarettahs_image_script\optimize_images;
  
  $new_page->verbose=1; // show messages as the run progresses.  if 0 then clas will not produce run messages
  $new_page->base_dir='/image_folder/';  // folder where original images are.   This folder must exist
  $new_page->optimized_dir='/optimized_folder/';  // folder to put resized images in.  Program will try to create this folder if it is not there
  $new_page->thumb_dir='/thumbs_folder/'; // folder to put thumbs into. Program will try to create this folder if not there.  If left blank then will not create thumbs.
  $new_page->watermark='watermark_image'; // image to use for watermark.  If left blank then no watermark will be used
  $new_page->image_output='gif'; // can be jpg, gif or png

  echo "Start of run " . date("M d Y H:i:s", time()) . "<br>\n";  
  flush();
  
  $new_page->mainline();   // runs the program

  if(!empty($new_page->errmess))
  {
    echo "Errors: " . $new_page->errmess . "<br>\n";     // lists errors
  }
  else
  {
    echo "There were no errors<br>\n";
  }
  
  echo "End of run " . date("M d Y H:i:s", time()) . "<br>\n";

  // show the total counts
  
  echo "Made " . $new_page->tot_files_made . " optimized images<br>\n";
  echo $new_page->tot_files_failed . " optimized images failed<br>\n";
  echo "Made " . $new_page->tot_thumbs_made . " thumb images<br>\n";
  echo $new_page->tot_thumbs_failed . " thumb images failed<br>\n";
?>
sarettah is offline   Reply With Quote