summaryrefslogtreecommitdiffstats
path: root/system/libraries/Image_lib.php
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2008-05-13 06:22:33 +0200
committerDerek Jones <derek.jones@ellislab.com>2008-05-13 06:22:33 +0200
commit0b59f270a432f8c7b6128981f0a39b4a2e2fbd34 (patch)
tree1e7655eabd76bb981692f5d4f21cb1fc7be3e9cd /system/libraries/Image_lib.php
parent5cf664748ee295867f593d7eb7991bd35fe8eca6 (diff)
Some sweeping syntax changes for consistency:
(! foo) changed to ( ! foo) || changed to OR changed newline standardization code in various places from preg_replace to str_replace
Diffstat (limited to 'system/libraries/Image_lib.php')
-rw-r--r--system/libraries/Image_lib.php60
1 files changed, 30 insertions, 30 deletions
diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index 4017afb13..a602b4645 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -1,4 +1,4 @@
-<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -158,7 +158,7 @@ class CI_Image_lib {
* properties using ImageMagick and NetPBM
*
*/
- if (! function_exists('getimagesize'))
+ if ( ! function_exists('getimagesize'))
{
$this->set_error('imglib_gd_required_for_props');
return FALSE;
@@ -188,7 +188,7 @@ class CI_Image_lib {
$this->source_folder = str_replace($this->source_image, '', $full_source_path);
// Set the Image Properties
- if (! $this->get_image_properties($this->source_folder.$this->source_image))
+ if ( ! $this->get_image_properties($this->source_folder.$this->source_image))
{
return FALSE;
}
@@ -226,7 +226,7 @@ class CI_Image_lib {
}
// Is there a file name?
- if (! preg_match("#[\.jpg|\.jpeg|\.gif|\.png]$#i", $full_dest_path))
+ if ( ! preg_match("#[\.jpg|\.jpeg|\.gif|\.png]$#i", $full_dest_path))
{
$this->dest_folder = $full_dest_path.'/';
$this->dest_image = $this->source_image;
@@ -478,7 +478,7 @@ class CI_Image_lib {
// we'll simply make a copy of the original with the new name
if (($this->orig_width == $this->width AND $this->orig_height == $this->height) AND ($this->source_image != $this->new_image))
{
- if (! @copy($this->full_src_path, $this->full_dst_path))
+ if ( ! @copy($this->full_src_path, $this->full_dst_path))
{
$this->set_error('imglib_copy_failed');
return FALSE;
@@ -494,7 +494,7 @@ class CI_Image_lib {
}
// Create the image handle
- if (! ($src_img = $this->image_create_gd()))
+ if ( ! ($src_img = $this->image_create_gd()))
{
return FALSE;
}
@@ -528,7 +528,7 @@ class CI_Image_lib {
else
{
// Or save it
- if (! $this->image_save_gd($dst_img))
+ if ( ! $this->image_save_gd($dst_img))
{
return FALSE;
}
@@ -564,9 +564,9 @@ class CI_Image_lib {
return FALSE;
}
- if (! eregi("convert$", $this->library_path))
+ if ( ! eregi("convert$", $this->library_path))
{
- if (! eregi("/$", $this->library_path)) $this->library_path .= "/";
+ if ( ! eregi("/$", $this->library_path)) $this->library_path .= "/";
$this->library_path .= 'convert';
}
@@ -712,14 +712,14 @@ class CI_Image_lib {
{
// Is Image Rotation Supported?
// this function is only supported as of PHP 4.3
- if (! function_exists('imagerotate'))
+ if ( ! function_exists('imagerotate'))
{
$this->set_error('imglib_rotate_unsupported');
return FALSE;
}
// Create the image handle
- if (! ($src_img = $this->image_create_gd()))
+ if ( ! ($src_img = $this->image_create_gd()))
{
return FALSE;
}
@@ -742,7 +742,7 @@ class CI_Image_lib {
else
{
// Or save it
- if (! $this->image_save_gd($dst_img))
+ if ( ! $this->image_save_gd($dst_img))
{
return FALSE;
}
@@ -771,7 +771,7 @@ class CI_Image_lib {
*/
function image_mirror_gd()
{
- if (! $src_img = $this->image_create_gd())
+ if ( ! $src_img = $this->image_create_gd())
{
return FALSE;
}
@@ -828,7 +828,7 @@ class CI_Image_lib {
else
{
// Or save it
- if (! $this->image_save_gd($src_img))
+ if ( ! $this->image_save_gd($src_img))
{
return FALSE;
}
@@ -877,7 +877,7 @@ class CI_Image_lib {
*/
function overlay_watermark()
{
- if (! function_exists('imagecolortransparent'))
+ if ( ! function_exists('imagecolortransparent'))
{
$this->set_error('imglib_gd_required');
return FALSE;
@@ -968,7 +968,7 @@ class CI_Image_lib {
}
else
{
- if (! $this->image_save_gd($src_img))
+ if ( ! $this->image_save_gd($src_img))
{
return FALSE;
}
@@ -990,7 +990,7 @@ class CI_Image_lib {
*/
function text_watermark()
{
- if (! ($src_img = $this->image_create_gd()))
+ if ( ! ($src_img = $this->image_create_gd()))
{
return FALSE;
}
@@ -1144,7 +1144,7 @@ class CI_Image_lib {
switch ($image_type)
{
case 1 :
- if (! function_exists('imagecreatefromgif'))
+ if ( ! function_exists('imagecreatefromgif'))
{
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_gif_not_supported'));
return FALSE;
@@ -1153,7 +1153,7 @@ class CI_Image_lib {
return imagecreatefromgif($path);
break;
case 2 :
- if (! function_exists('imagecreatefromjpeg'))
+ if ( ! function_exists('imagecreatefromjpeg'))
{
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_jpg_not_supported'));
return FALSE;
@@ -1162,7 +1162,7 @@ class CI_Image_lib {
return imagecreatefromjpeg($path);
break;
case 3 :
- if (! function_exists('imagecreatefrompng'))
+ if ( ! function_exists('imagecreatefrompng'))
{
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported'));
return FALSE;
@@ -1194,7 +1194,7 @@ class CI_Image_lib {
switch ($this->image_type)
{
case 1 :
- if (! function_exists('imagegif'))
+ if ( ! function_exists('imagegif'))
{
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_gif_not_supported'));
return FALSE;
@@ -1203,7 +1203,7 @@ class CI_Image_lib {
@imagegif($resource, $this->full_dst_path);
break;
case 2 :
- if (! function_exists('imagejpeg'))
+ if ( ! function_exists('imagejpeg'))
{
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_jpg_not_supported'));
return FALSE;
@@ -1217,7 +1217,7 @@ class CI_Image_lib {
@imagejpeg($resource, $this->full_dst_path, $this->quality);
break;
case 3 :
- if (! function_exists('imagepng'))
+ if ( ! function_exists('imagepng'))
{
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported'));
return FALSE;
@@ -1280,10 +1280,10 @@ class CI_Image_lib {
*/
function image_reproportion()
{
- if (! is_numeric($this->width) OR ! is_numeric($this->height) OR $this->width == 0 OR $this->height == 0)
+ if ( ! is_numeric($this->width) OR ! is_numeric($this->height) OR $this->width == 0 OR $this->height == 0)
return;
- if (! is_numeric($this->orig_width) OR ! is_numeric($this->orig_height) OR $this->orig_width == 0 OR $this->orig_height == 0)
+ if ( ! is_numeric($this->orig_width) OR ! is_numeric($this->orig_height) OR $this->orig_width == 0 OR $this->orig_height == 0)
return;
$new_width = ceil($this->orig_width*$this->height/$this->orig_height);
@@ -1328,7 +1328,7 @@ class CI_Image_lib {
if ($path == '')
$path = $this->full_src_path;
- if (! file_exists($path))
+ if ( ! file_exists($path))
{
$this->set_error('imglib_invalid_path');
return FALSE;
@@ -1382,14 +1382,14 @@ class CI_Image_lib {
*/
function size_calculator($vals)
{
- if (! is_array($vals))
+ if ( ! is_array($vals))
return;
$allowed = array('new_width', 'new_height', 'width', 'height');
foreach ($allowed as $item)
{
- if (! isset($vals[$item]) OR $vals[$item] == '')
+ if ( ! isset($vals[$item]) OR $vals[$item] == '')
$vals[$item] = 0;
}
@@ -1460,9 +1460,9 @@ class CI_Image_lib {
*/
function gd_loaded()
{
- if (! extension_loaded('gd'))
+ if ( ! extension_loaded('gd'))
{
- if (! dl('gd.so'))
+ if ( ! dl('gd.so'))
{
return FALSE;
}