diff options
-rw-r--r-- | actions/settings.php | 13 | ||||
-rw-r--r-- | languages/en.php | 4 | ||||
-rw-r--r-- | lib/resize.php | 38 | ||||
-rw-r--r-- | settings.php | 26 | ||||
-rw-r--r-- | start.php | 7 | ||||
-rw-r--r-- | tidypics_settings/manifest.xml | 10 | ||||
-rw-r--r-- | tidypics_settings/readme.txt | 27 | ||||
-rw-r--r-- | tidypics_settings/start.php | 35 | ||||
-rw-r--r-- | views/default/tidypics/forms/admin.php | 19 |
9 files changed, 61 insertions, 118 deletions
diff --git a/actions/settings.php b/actions/settings.php index c0f53c71d..29a77577f 100644 --- a/actions/settings.php +++ b/actions/settings.php @@ -30,6 +30,19 @@ set_plugin_setting('tagging', 'enabled', 'tidypics');
else
set_plugin_setting('tagging', 'disabled', 'tidypics');
+
+
+ // image sizes
+ $image_sizes = array();
+ $image_sizes['large_image_width'] = get_input('large_thumb_width');
+ $image_sizes['large_image_height'] = get_input('large_thumb_height');
+ $image_sizes['small_image_width'] = get_input('small_thumb_width');
+ $image_sizes['small_image_height'] = get_input('small_thumb_height');
+ $image_sizes['thumb_image_width'] = get_input('thumb_width');
+ $image_sizes['thumb_image_height'] = get_input('thumb_height');
+ set_plugin_setting('image_sizes', serialize($image_sizes), 'tidypics');
+
+
system_message(elgg_echo('tidypics:settings:save:ok'));
diff --git a/languages/en.php b/languages/en.php index 6354f9ad1..432da458d 100644 --- a/languages/en.php +++ b/languages/en.php @@ -40,6 +40,9 @@ 'tidypics:settings:watermark' => "Enter text to appear in the watermark - ImageMagick must be selected for the image library",
'tidypics:settings:im_path' => "Enter the path to your ImageMagick commands",
'tidypics:settings:river_view' => "How many entries in river for each batch of uploaded images",
+ 'tidypics:settings:largesize' => "Primary image size",
+ 'tidypics:settings:smallsize' => "Album view image size",
+ 'tidypics:settings:thumbsize' => "Thumbnail image size",
//actions
@@ -136,6 +139,7 @@ 'tidypics:not_image' => "This is not a recognized image type",
'image:deletefailed' => "Your image could not be deleted at this time.",
'image:downloadfailed' => "Sorry; this image is not available at this time.",
+ 'tidypics:nosettings' => "Admin of this site has not set photo album settings.",
'images:notedited' => "Not all images were successfully updated",
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) {
diff --git a/settings.php b/settings.php deleted file mode 100644 index a18660da0..000000000 --- a/settings.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php
-
-/*******************************************************************
- *
- * Tidypics Settings
- *
- * DO NOT CHANGE THESE - Use tidypics_settings plugin
- *
- ********************************************************************/
-
-/////////////////////////////////////////////////////////////////////
-// Image sizes - Tidypics makes 3 views of an image:
-// Large - displayed when viewing the image alone
-// Small - displayed on an album page
-// Thumb - used for the activity log
-// There is also the original image that is available for download
- $CONFIG->tidypics->image_large_width = 600;
- $CONFIG->tidypics->image_large_height = 600;
-
- $CONFIG->tidypics->image_small_width = 153;
- $CONFIG->tidypics->image_small_height = 153;
-
- $CONFIG->tidypics->image_thumb_width = 60;
- $CONFIG->tidypics->image_thumb_height = 60;
-
-?>
\ No newline at end of file @@ -8,13 +8,6 @@ define('TP_OLD_ALBUM', 0);
define('TP_NEW_ALBUM', 1);
-
- // setup tidypics settings object
- global $CONFIG;
- if (!isset($CONFIG->tidypics))
- $CONFIG->tidypics = new stdClass;
- include dirname(__FILE__) . "/settings.php";
-
/**
diff --git a/tidypics_settings/manifest.xml b/tidypics_settings/manifest.xml deleted file mode 100644 index 3ee22d192..000000000 --- a/tidypics_settings/manifest.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<plugin_manifest> - <field key="author" value="Gabriel Monge-Franco and the TidyPics team." /> - <field key="version" value="1.5.1" /> - <field key="description" value="Tidypics Settings Plugin" /> - <field key="website" value="http://code.google.com/p/tidypics/" /> - <field key="copyright" value="2008-2009 Gabriel Monge-Franco" /> - <field key="licence" value="GNU General Public License version 3" /> - <field key="elgg_version" value="2009022701" /> -</plugin_manifest> diff --git a/tidypics_settings/readme.txt b/tidypics_settings/readme.txt deleted file mode 100644 index 2f6ff9cca..000000000 --- a/tidypics_settings/readme.txt +++ /dev/null @@ -1,27 +0,0 @@ -What is this?
-=============================
-tidypics_settings is a plugin
-
-
-What does it do?
-=============================
-It allows you to override settings in tidypics like the size of images or whether images
-can be downloaded or not. By changing those settings in this plugin and NOT in the
-tidypics plugin, you can upgrade to new versions without worrying about losing your
-custom settings.
-
-
-How do I install it?
-=============================
-1. Copy the tidypics_settings directory to your Elgg mod directory. You should now have
-a directory path like this: /mod/tidypics_settings
-
-2. Under that directory, you should have 2 files: this readme and a start.php file. Edit
-this start.php file to change any settings that you want to change (uncomment the setting
-and then change its value).
-
-3. Confirm that this plugin appears below tidypics on the plugin list in Tools Administration.
-It does not have to be directly below. Just as long as it is loaded afterwards.
-
-4. Enable the plugin under Tools Administration in your Elgg install. If you get a misconfigured
-plugin error message, you've done something dumb.
diff --git a/tidypics_settings/start.php b/tidypics_settings/start.php deleted file mode 100644 index 6332050a8..000000000 --- a/tidypics_settings/start.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php
- /**
- * Elgg tidypics_settings plugin
- *
- * Only uncomment and change settings that you want to change.
- *
- */
-
- // setup tidypics settings object
- global $CONFIG;
- if (!isset($CONFIG->tidypics)) {
- error_log('tidypics_settings: error - not loaded after tidypics plugin!!!');
- }
-
-
-/////////////////////////////////////////////////////////////////////
-// Image sizes - Tidypics makes 3 views of an image:
-// Large - displayed when viewing the image alone
-// Small - displayed on an album page
-// Thumb - used for the activity log
-// There is also the original image that is available for download
-// $CONFIG->tidypics->image_large_width = 600;
-// $CONFIG->tidypics->image_large_height = 600;
-
-// $CONFIG->tidypics->image_small_width = 153;
-// $CONFIG->tidypics->image_small_height = 153;
-
-// $CONFIG->tidypics->image_thumb_width = 60;
-// $CONFIG->tidypics->image_thumb_height = 60;
-
-
-
-
-
-?>
\ No newline at end of file diff --git a/views/default/tidypics/forms/admin.php b/views/default/tidypics/forms/admin.php index 19bde2fe6..c5e7c68d0 100644 --- a/views/default/tidypics/forms/admin.php +++ b/views/default/tidypics/forms/admin.php @@ -71,7 +71,24 @@ $form_body .= '</p>';
// Thumbnail sizes
-
+ $image_sizes = $plugin->image_sizes;
+ if(!$image_sizes) {
+ $image_sizes = array(); // set default values
+ $image_sizes['large_image_width'] = $image_sizes['large_image_height'] = 600;
+ $image_sizes['small_image_width'] = $image_sizes['small_image_height'] = 153;
+ $image_sizes['thumb_image_width'] = $image_sizes['thumb_image_height'] = 60;
+ } else {
+ $image_sizes = unserialize($image_sizes);
+ }
+ $form_body .= "<p>" . elgg_echo('tidypics:settings:largesize') . "<br />";
+ $form_body .= 'width: <input style="width: 20%;" type="text" name="large_thumb_width" value=' . "\"{$image_sizes['large_image_width']}\"" . ' class="input-text" /> ';
+ $form_body .= 'height: <input style="width: 20%;" type="text" name="large_thumb_height" value=' . "\"{$image_sizes['large_image_height']}\"" . ' class="input-text" /></p>';
+ $form_body .= "<p>" . elgg_echo('tidypics:settings:smallsize') . "<br />";
+ $form_body .= 'width: <input style="width: 20%;" type="text" name="small_thumb_width" value=' . "\"{$image_sizes['small_image_width']}\"" . ' class="input-text" /> ';
+ $form_body .= 'height: <input style="width: 20%;" type="text" name="small_thumb_height" value=' . "\"{$image_sizes['small_image_height']}\"" . ' class="input-text" /></p>';
+ $form_body .= "<p>" . elgg_echo('tidypics:settings:thumbsize') . "<br />";
+ $form_body .= 'width: <input style="width: 20%;" type="text" name="thumb_width" value=' . "\"{$image_sizes['thumb_image_width']}\"" . ' class="input-text" /> ';
+ $form_body .= 'height: <input style="width: 20%;" type="text" name="thumb_height" value=' . "\"{$image_sizes['thumb_image_height']}\"" . ' class="input-text" /></p>';
$form_body .= elgg_view('input/submit', array('value' => elgg_echo("save")));
|