Example #1
0
<?php

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$plugin_info = array(
	'pi_name'        => 'ImageSizer',
	'pi_version'     => '2.6.4',
	'pi_author'      => 'David Rencher',
	'pi_author_url'  => 'http://www.lumis.com/',
	'pi_description' => 'Image Resizer - resizes and caches images',
	'pi_usage'       => Imgsizer::usage()
  );


class Imgsizer
{

var $return_data = ""; 

  function Imgsizer()
  {
    $this->EE =& get_instance();
  }
  
  function size()
	{
		// --------------------------------------------------
		//  Determine base path
		// --------------------------------------------------
	
		// checks if server supports $ENV DOCUMENT_ROOT use $_SERVER otherwise
Example #2
0
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
$plugin_info = array('pi_name' => 'ImageSizer', 'pi_version' => '2.6.4', 'pi_author' => 'David Rencher', 'pi_author_url' => 'http://www.lumis.com/', 'pi_description' => 'Image Resizer - resizes and caches images', 'pi_usage' => Imgsizer::usage());
class Imgsizer
{
    var $return_data = "";
    function Imgsizer()
    {
        $this->EE =& get_instance();
    }
    function size()
    {
        // --------------------------------------------------
        //  Determine base path
        // --------------------------------------------------
        // checks if server supports $ENV DOCUMENT_ROOT use $_SERVER otherwise
        if (array_key_exists('DOCUMENT_ROOT', $_ENV)) {
            $base_path = $_ENV['DOCUMENT_ROOT'] . "/";
        } else {
            $base_path = $_SERVER['DOCUMENT_ROOT'] . "/";
        }
        $base_path = str_replace("\\", "/", $base_path);
        $base_path = $this->EE->functions->remove_double_slashes($base_path);
        // -------------------------------------
        // define some defaults
        // -------------------------------------
        $img = array();
        $okmime = array("image/png", "image/gif", "image/jpeg");