diff options
author | Cash Costello <cash.costello@gmail.com> | 2009-06-05 11:26:42 +0000 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2009-06-05 11:26:42 +0000 |
commit | 8e8e50d510608d94e266e3c951349a45046dfc67 (patch) | |
tree | 5e66e93e3ca120a3d473cc38226e37072d78d0fd /lib/resize.php | |
parent | ee733ee32b08e062ab868a3b26c3cbe73852a28e (diff) | |
download | elgg-8e8e50d510608d94e266e3c951349a45046dfc67.tar.gz elgg-8e8e50d510608d94e266e3c951349a45046dfc67.tar.bz2 |
added image sizes to settings and removed deprecated settings object
Diffstat (limited to 'lib/resize.php')
-rw-r--r-- | lib/resize.php | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/lib/resize.php b/lib/resize.php index f9b7843e5..186900f7d 100644 --- a/lib/resize.php +++ b/lib/resize.php @@ -19,10 +19,17 @@ $mime = $file->getMimeType();
+ $image_sizes = get_plugin_setting('image_sizes', 'tidypics');
+ if (!$image_sizes) {
+ register_error(elgg_echo('tidypics:nosettings'));
+ return false;
+ }
+ $image_sizes = unserialize($image_sizes);
+
// Generate thumbnails
$thumbnail = get_resized_image_from_existing_file( $file->getFilenameOnFilestore(),
- $CONFIG->tidypics->image_thumb_width,
- $CONFIG->tidypics->image_thumb_height,
+ $image_sizes['thumb_image_width'],
+ $image_sizes['thumb_image_height'],
true);
if ($thumbnail) {
@@ -41,8 +48,8 @@ unset($thumbnail);
$thumbsmall = get_resized_image_from_existing_file( $file->getFilenameOnFilestore(),
- $CONFIG->tidypics->image_small_width,
- $CONFIG->tidypics->image_small_height,
+ $image_sizes['small_image_width'],
+ $image_sizes['small_image_height'],
true);
@@ -62,8 +69,8 @@ unset($thumbsmall);
$thumblarge = get_resized_image_from_existing_file( $file->getFilenameOnFilestore(),
- $CONFIG->tidypics->image_large_width,
- $CONFIG->tidypics->image_large_height,
+ $image_sizes['large_image_width'],
+ $image_sizes['large_image_height'],
false);
if ($thumblarge) {
@@ -116,22 +123,29 @@ $mime = $file->getMimeType();
+ $image_sizes = get_plugin_setting('image_sizes', 'tidypics');
+ if (!$image_sizes) {
+ register_error(elgg_echo('tidypics:nosettings'));
+ return array();
+ }
+ $image_sizes = unserialize($image_sizes);
+
$thumblarge = tp_imagick_resize($file->getFilenameOnFilestore(),
"largethumb",
- $CONFIG->tidypics->image_large_width,
- $CONFIG->tidypics->image_large_height,
+ $image_sizes['large_image_width'],
+ $image_sizes['large_image_height'],
false);
$thumbsmall = tp_imagick_resize($file->getFilenameOnFilestore(),
"smallthumb",
- $CONFIG->tidypics->image_small_width,
- $CONFIG->tidypics->image_small_height,
+ $image_sizes['small_image_width'],
+ $image_sizes['small_image_height'],
true);
$thumbnail = tp_imagick_resize($file->getFilenameOnFilestore(),
"thumb",
- $CONFIG->tidypics->image_thumb_width,
- $CONFIG->tidypics->image_thumb_height,
+ $image_sizes['thumb_image_width'],
+ $image_sizes['thumb_image_height'],
true);
if ($thumbnail) {
|