added some better error checking for saving files with GD
diff --git a/system/language/english/imglib_lang.php b/system/language/english/imglib_lang.php
index a587c0b..66505da 100644
--- a/system/language/english/imglib_lang.php
+++ b/system/language/english/imglib_lang.php
@@ -17,6 +17,7 @@
$lang['imglib_invalid_path'] = "The path to the image is not correct.";
$lang['imglib_copy_failed'] = "The image copy routine failed.";
$lang['imglib_missing_font'] = "Unable to find a font to use.";
+$lang['imglib_save_failed'] = "Unable to save the image. Please make sure the image and file directory are writable.";
/* End of file imglib_lang.php */
diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index 1b2d33d..0e7f214 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -1195,7 +1195,11 @@
return FALSE;
}
- @imagegif($resource, $this->full_dst_path);
+ if ( ! @imagegif($resource, $this->full_dst_path))
+ {
+ $this->set_error('imglib_save_failed');
+ return FALSE;
+ }
break;
case 2 :
if ( ! function_exists('imagejpeg'))
@@ -1209,7 +1213,11 @@
@touch($this->full_dst_path); // PHP 4.4.1 bug #35060 - workaround
}
- @imagejpeg($resource, $this->full_dst_path, $this->quality);
+ if ( ! @imagejpeg($resource, $this->full_dst_path, $this->quality))
+ {
+ $this->set_error('imglib_save_failed');
+ return FALSE;
+ }
break;
case 3 :
if ( ! function_exists('imagepng'))
@@ -1218,7 +1226,11 @@
return FALSE;
}
- @imagepng($resource, $this->full_dst_path);
+ if ( ! @imagepng($resource, $this->full_dst_path))
+ {
+ $this->set_error('imglib_save_failed');
+ return FALSE;
+ }
break;
default :
$this->set_error(array('imglib_unsupported_imagecreate'));
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 3dd056d..9c09fab 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -69,6 +69,7 @@
<li>Added <big>, <small>, <q>, and <tt> to the Typography parser's inline elements.</li>
<li>Added more accurate error reporting for the Email library when using sendmail.</li>
<li>Removed a strict type check from the <kbd>rotate()</kbd> function of the <a href="libraries/image_lib.html">Image Manipulation Class</a>.</li>
+ <li>Added enhanced error checking in file saving in the Image library when using the GD lib.</li>
</ul>
</li>
<li>Database