]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Users cannot change the 2 smallest thumbnails from square now - less confusing interface
authorCash Costello <cash.costello@gmail.com>
Sat, 1 May 2010 19:24:58 +0000 (19:24 +0000)
committerCash Costello <cash.costello@gmail.com>
Sat, 1 May 2010 19:24:58 +0000 (19:24 +0000)
actions/settings.php
contributions.txt
languages/en.php
lib/resize.php
views/default/tidypics/forms/settings.php

index e16e7960ef09502e29f69653a9e85d5c51ee299a..a4f102b894b6f26c9204d1c96157488f6755b89e 100644 (file)
        $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['small_image_height'] = get_input('small_thumb_height');
+       $image_sizes['small_image_height'] = get_input('small_thumb_width');
        $image_sizes['thumb_image_width'] = get_input('thumb_width');
-       $image_sizes['thumb_image_height'] = get_input('thumb_height');
+       //$image_sizes['thumb_image_height'] = get_input('thumb_height');
+       $image_sizes['thumb_image_height'] = get_input('thumb_width');
        set_plugin_setting('image_sizes', serialize($image_sizes), 'tidypics');
 
 
index 2e09ca1cf904aadb9a6028fb7a05ff8766ccfb21..3cea54bd9975e5d0e6dcd56048ce55f96428d62a 100644 (file)
@@ -1,4 +1,4 @@
-See individual change logs for contributors to those builds\r
+Changelog and contributors list\r
 \r
 \r
 ------------------------------------------------------------------------\r
@@ -8,9 +8,14 @@ Release Date: 05/01/2010
 BEGIN VERSION 1.6.8 CHANGES\r
 ------------------------------------------------------------------------\r
  * New language strings: tidypics:nophotosingroup, tidypics:baduploadform\r
+                         tidypics:settings:heading:img_lib, tidypics:settings:heading:main,\r
+                                                tidypics:settings:heading:river, tidypics:settings:heading:sizes,\r
+                                                tidypics:settings:heading:groups\r
  * Fixed bug in titles of albums RSS\r
  * Added a new css element: tidypics_line_break\r
  * Fixed layout of album covers due to long titles or other text\r
+ * Fixed some bugs with image resizing when images are wide and short\r
+ * Improved interface of admin settings\r
 ------------------------------------------------------------------------\r
 END VERSION 1.6.8 CHANGES\r
 ------------------------------------------------------------------------\r
index 30cef2db484796884e584ee725707273764dac71..934c8ae5abe231214b30ea9d046625243e26b832 100644 (file)
                        'tidypics:settings:grp_perm_override' => "Allow group members full access to group albums",
                        'tidypics:settings:maxfilesize' => "Maximum image size in megabytes (MB):",
                        'tidypics:settings:quota' => "User/Group Quota (MB) - 0 equals no quota",
-                       'tidypics:settings:watermark' => "Enter text to appear in the watermark - not for production sites yet",
+                       'tidypics:settings:watermark' => "Enter text to appear in the watermark",
                        'tidypics:settings:im_path' => "Enter the path to your ImageMagick commands (with trailing slash)",
-                       'tidypics:settings:img_river_view' => "How many entries in river for each batch of uploaded images",
+                       'tidypics:settings:img_river_view' => "How many entries in activity river for each batch of uploaded images",
                        'tidypics:settings:album_river_view' => "Show the album cover or a set of photos for new album",
                        'tidypics:settings:largesize' => "Primary image size",
                        'tidypics:settings:smallsize' => "Album view image size",
                        'tidypics:settings:thumbsize' => "Thumbnail image size",
                        'tidypics:settings:im_id' => "Image ID",
+
+                       'tidypics:settings:heading:img_lib' => "Image Library Settings",
+                       'tidypics:settings:heading:main' => "Major Settings",
+                       'tidypics:settings:heading:river' => "Activity Integration Options",
+                       'tidypics:settings:heading:sizes' => "Thumbnail Size",
+                       'tidypics:settings:heading:groups' => "Group Settings",
        
                //actions
 
index b0cfb8de3c6c753dcdb864e26160b080e86de991..857d0ba1cc93dffc8f5eb8a16a864f6e2c051e93 100644 (file)
@@ -14,7 +14,7 @@ include dirname(__FILE__) . "/watermark.php";
  * @param ElggFile holds the image that was uploaded
  * @param string   folder to store thumbnail in
  * @param string   name of the thumbnail
- * @return bool    true on success
+ * @return bool    TRUE on success
  */
 function tp_create_gd_thumbnails($file, $prefix, $filestorename) {
        global $CONFIG;
@@ -24,7 +24,7 @@ function tp_create_gd_thumbnails($file, $prefix, $filestorename) {
                // move this out of library
                register_error(elgg_echo('tidypics:nosettings'));
                forward($_SERVER['HTTP_REFERER']);
-               return false;
+               return FALSE;
        }
        $image_sizes = unserialize($image_sizes);
 
@@ -37,12 +37,12 @@ function tp_create_gd_thumbnails($file, $prefix, $filestorename) {
        $thumbname = $thumb->getFilenameOnFilestore();
        $rtn_code = tp_gd_resize(       $file->getFilenameOnFilestore(),
                                                                $thumbname,
-                                                               false,
+                                                               FALSE,
                                                                $image_sizes['thumb_image_width'],
                                                                $image_sizes['thumb_image_height'],
-                                                               true);
+                                                               TRUE);
        if (!$rtn_code) {
-               return false;
+               return FALSE;
        }
        $file->thumbnail = $prefix."thumb".$filestorename;
 
@@ -53,12 +53,12 @@ function tp_create_gd_thumbnails($file, $prefix, $filestorename) {
        $thumbname = $thumb->getFilenameOnFilestore();
        $rtn_code = tp_gd_resize(       $file->getFilenameOnFilestore(),
                                                                $thumbname,
-                                                               false,
+                                                               FALSE,
                                                                $image_sizes['small_image_width'],
                                                                $image_sizes['small_image_height'],
-                                                               true);
+                                                               TRUE);
        if (!$rtn_code) {
-               return false;
+               return FALSE;
        }
        $file->smallthumb = $prefix."smallthumb".$filestorename;
        unset($CONFIG->debug);
@@ -68,19 +68,19 @@ function tp_create_gd_thumbnails($file, $prefix, $filestorename) {
        $thumbname = $thumb->getFilenameOnFilestore();
        $rtn_code = tp_gd_resize(       $file->getFilenameOnFilestore(),
                                                                $thumbname,
-                                                               true,
+                                                               TRUE,
                                                                $image_sizes['large_image_width'],
                                                                $image_sizes['large_image_height'],
-                                                               false);
+                                                               FALSE);
        if (!$rtn_code) {
-               return false;
+               return FALSE;
        }
        $file->largethumb = $prefix."largethumb".$filestorename;
 
 
        unset($thumb);
 
-       return true;
+       return TRUE;
 }
 
 /**
@@ -92,10 +92,10 @@ function tp_create_gd_thumbnails($file, $prefix, $filestorename) {
  * @param bool - watermark this image?
  * @param int $maxwidth The maximum width of the resized image
  * @param int $maxheight The maximum height of the resized image
- * @param true|false $square If set to true, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
- * @return bool true on success or false on failure
+ * @param TRUE|FALSE $square If set to TRUE, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
+ * @return bool TRUE on success or FALSE on failure
  */
-function tp_gd_resize($input_name, $output_name, $watermark, $maxwidth, $maxheight, $square = false, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
+function tp_gd_resize($input_name, $output_name, $watermark, $maxwidth, $maxheight, $square = FALSE, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
 
        // Get the size information from the image
        $imgsizearray = getimagesize($input_name);
@@ -130,19 +130,19 @@ function tp_gd_resize($input_name, $output_name, $watermark, $maxwidth, $maxheig
        // make sure the function is available
        $function = "imagecreatefrom" . $accepted_formats[$imgsizearray['mime']];
        if (!is_callable($function)) {
-               return false;
+               return FALSE;
        }
 
        // load old image
        $oldimage = $function($input_name);
        if (!$oldimage) {
-               return false;
+               return FALSE;
        }
 
        // allocate the new image
        $newimage = imagecreatetruecolor($new_width, $new_height);
        if (!$newimage) {
-               return false;
+               return FALSE;
        }
 
        $rtn_code = imagecopyresampled( $newimage,
@@ -190,13 +190,13 @@ function tp_gd_resize($input_name, $output_name, $watermark, $maxwidth, $maxheig
  * @param ElggFile holds the image that was uploaded
  * @param string   folder to store thumbnail in
  * @param string   name of the thumbnail
- * @return bool    true on success
+ * @return bool    TRUE on success
  */
 function tp_create_imagick_thumbnails($file, $prefix, $filestorename) {
        $image_sizes = get_plugin_setting('image_sizes', 'tidypics');
        if (!$image_sizes) {
                register_error(elgg_echo('tidypics:nosettings'));
-               return false;
+               return FALSE;
        }
        $image_sizes = unserialize($image_sizes);
 
@@ -211,9 +211,9 @@ function tp_create_imagick_thumbnails($file, $prefix, $filestorename) {
                                                                        $thumbname,
                                                                        $image_sizes['thumb_image_width'],
                                                                        $image_sizes['thumb_image_height'],
-                                                                       true);
+                                                                       TRUE);
        if (!$rtn_code) {
-               return false;
+               return FALSE;
        }
        $file->thumbnail = $prefix."thumb".$filestorename;
 
@@ -224,9 +224,9 @@ function tp_create_imagick_thumbnails($file, $prefix, $filestorename) {
                                                                        $thumbname,
                                                                        $image_sizes['small_image_width'],
                                                                        $image_sizes['small_image_height'],
-                                                                       true);
+                                                                       TRUE);
        if (!$rtn_code) {
-               return false;
+               return FALSE;
        }
        $file->smallthumb = $prefix."smallthumb".$filestorename;
 
@@ -237,9 +237,9 @@ function tp_create_imagick_thumbnails($file, $prefix, $filestorename) {
                                                                        $thumbname,
                                                                        $image_sizes['large_image_width'],
                                                                        $image_sizes['large_image_height'],
-                                                                       false);
+                                                                       FALSE);
        if (!$rtn_code) {
-               return false;
+               return FALSE;
        }
        $file->largethumb = $prefix."largethumb".$filestorename;
 
@@ -247,7 +247,7 @@ function tp_create_imagick_thumbnails($file, $prefix, $filestorename) {
 
        unset($thumb);
 
-       return true;
+       return TRUE;
 }
 
 
@@ -261,10 +261,10 @@ function tp_create_imagick_thumbnails($file, $prefix, $filestorename) {
  * @param string $output_name The name of the file to be written
  * @param int $maxwidth The maximum width of the resized image
  * @param int $maxheight The maximum height of the resized image
- * @param true|false $square If set to true, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
- * @return bool true on success
+ * @param TRUE|FALSE $square If set to TRUE, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
+ * @return bool TRUE on success
  */
-function tp_imagick_resize($input_name, $output_name, $maxwidth, $maxheight, $square = false, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
+function tp_imagick_resize($input_name, $output_name, $maxwidth, $maxheight, $square = FALSE, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
 
        // Get the size information from the image
        $imgsizearray = getimagesize($input_name);
@@ -316,13 +316,13 @@ function tp_imagick_resize($input_name, $output_name, $maxwidth, $maxheight, $sq
  * @param ElggFile holds the image that was uploaded
  * @param string   folder to store thumbnail in
  * @param string   name of the thumbnail
- * @return bool    true on success
+ * @return bool    TRUE on success
  */
 function tp_create_im_cmdline_thumbnails($file, $prefix, $filestorename) {
        $image_sizes = get_plugin_setting('image_sizes', 'tidypics');
        if (!$image_sizes) {
                register_error(elgg_echo('tidypics:nosettings'));
-               return false;
+               return FALSE;
        }
        $image_sizes = unserialize($image_sizes);
 
@@ -337,9 +337,9 @@ function tp_create_im_cmdline_thumbnails($file, $prefix, $filestorename) {
                                                                                $thumbname,
                                                                                $image_sizes['thumb_image_width'],
                                                                                $image_sizes['thumb_image_height'],
-                                                                               true);
+                                                                               TRUE);
        if (!$rtn_code) {
-               return false;
+               return FALSE;
        }
        $file->thumbnail = $prefix."thumb".$filestorename;
 
@@ -351,9 +351,9 @@ function tp_create_im_cmdline_thumbnails($file, $prefix, $filestorename) {
                                                                                $thumbname,
                                                                                $image_sizes['small_image_width'],
                                                                                $image_sizes['small_image_height'],
-                                                                               true);
+                                                                               TRUE);
        if (!$rtn_code) {
-               return false;
+               return FALSE;
        }
        $file->smallthumb = $prefix."smallthumb".$filestorename;
 
@@ -364,9 +364,9 @@ function tp_create_im_cmdline_thumbnails($file, $prefix, $filestorename) {
                                                                                $thumbname,
                                                                                $image_sizes['large_image_width'],
                                                                                $image_sizes['large_image_height'],
-                                                                               false);
+                                                                               FALSE);
        if (!$rtn_code) {
-               return false;
+               return FALSE;
        }
        $file->largethumb = $prefix."largethumb".$filestorename;
 
@@ -375,21 +375,21 @@ function tp_create_im_cmdline_thumbnails($file, $prefix, $filestorename) {
 
        unset($thumb);
 
-       return true;
+       return TRUE;
 }
 
 /**
  * Gets the jpeg contents of the resized version of an already uploaded image
- * (Returns false if the uploaded file was not an image)
+ * (Returns FALSE if the uploaded file was not an image)
  *
  * @param string $input_name The name of the file input field on the submission form
  * @param string $output_name The name of the file to be written
  * @param int $maxwidth The maximum width of the resized image
  * @param int $maxheight The maximum height of the resized image
- * @param true|false $square If set to true, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
+ * @param TRUE|FALSE $square If set to TRUE, will take the smallest of maxwidth and maxheight and use it to set the dimensions on all size; the image will be cropped.
  * @return bool
  */
-function tp_im_cmdline_resize($input_name, $output_name, $maxwidth, $maxheight, $square = false, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
+function tp_im_cmdline_resize($input_name, $output_name, $maxwidth, $maxheight, $square = FALSE, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
 
 
        // Get the size information from the image
@@ -460,9 +460,9 @@ function tp_im_cmdline_resize($input_name, $output_name, $maxwidth, $maxheight,
  * @param int $y1
  * @param int $x2
  * @param int $y2
- * @return array|false
+ * @return array|FALSE
  */
-function tp_im_calc_resize_params($orig_width, $orig_height, $new_width, $new_height, $square = false, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
+function tp_im_calc_resize_params($orig_width, $orig_height, $new_width, $new_height, $square = FALSE, $x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0) {
        // crop image first?
        $crop = TRUE;
        if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 == 0) {
index 6cfed661f6c1370b35cd1299da8dc7eff738af9b..21b85b83f4b294946bc0378b0d90844d396beb9a 100644 (file)
 
 
        // Image Library
+       $form_body = '<h3>' . elgg_echo('tidypics:settings:heading:img_lib') . '</h3>';
        $image_lib = $plugin->image_lib;
        if (!$image_lib) $image_lib = 'GD';
-       $form_body = '<p>' . elgg_echo('tidypics:settings:image_lib') . ': ';
+       $form_body .= '<p>' . elgg_echo('tidypics:settings:image_lib') . ': ';
        $form_body .= elgg_view('input/pulldown', array(
                                        'internalname' => 'params[image_lib]',
                                        'options_values' => $img_lib_options,
@@ -45,6 +46,7 @@
        }
 
        // Tagging
+       $form_body .= '<h3>' . elgg_echo('tidypics:settings:heading:main') . '</h3>';
        $tagging = $plugin->tagging;
        if(!$tagging) $tagging = "enabled";
        $form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:tagging') => 'enabled'), 'internalname' => 'tagging', 'value' => $tagging )) . "</p>";
@@ -86,6 +88,7 @@
        $form_body .= elgg_view("input/text",array('internalname' => 'params[quota]', 'value' => $quota)) . "</p>";
 
        // River Image options
+       $form_body .= '<h3>' . elgg_echo('tidypics:settings:heading:river') . '</h3>';
        $img_river_view = $plugin->img_river_view;
        if (!$img_river_view) $img_river_view = '1';
        $form_body .= '<p>' . elgg_echo('tidypics:settings:img_river_view');
        $form_body .= '</p>';
 
        // Thumbnail sizes
+       $form_body .= '<h3>' . elgg_echo('tidypics:settings:heading:sizes') . '</h3>';
+       $form_body .= "<h6>You must edit the css if you change the default sizes</h6>";
        $image_sizes = $plugin->image_sizes;
        if(!$image_sizes) {
                $image_sizes = array(); // set default values 
        $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" />&nbsp;&nbsp;&nbsp;';
        $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" />&nbsp;&nbsp;&nbsp;';
-       $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 .= 'width and height: <input style="width: 20%;" type="text" name="small_thumb_width" value=' . "\"{$image_sizes['small_image_width']}\"" . ' class="input-text" />&nbsp;&nbsp;&nbsp;';
+       //$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" />&nbsp;&nbsp;&nbsp;';
-       $form_body .= 'height: <input style="width: 20%;" type="text" name="thumb_height" value=' . "\"{$image_sizes['thumb_image_height']}\"" . ' class="input-text" /></p>';
+       $form_body .= 'width and height: <input style="width: 20%;" type="text" name="thumb_width" value=' . "\"{$image_sizes['thumb_image_width']}\"" . ' class="input-text" />&nbsp;&nbsp;&nbsp;';
+       //$form_body .= 'height: <input style="width: 20%;" type="text" name="thumb_height" value=' . "\"{$image_sizes['thumb_image_height']}\"" . ' class="input-text" /></p>';
 
 
        // Group permission override
+       $form_body .= '<h3>' . elgg_echo('tidypics:settings:heading:groups') . '</h3>';
        $grp_perm_override = $plugin->grp_perm_override;
        if(!$grp_perm_override) $grp_perm_override = "enabled";
        $form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:grp_perm_override') => 'enabled'), 'internalname' => 'grp_perm_override', 'value' => $grp_perm_override )) . "</p>";