diff options
-rw-r--r-- | actions/settings.php | 6 | ||||
-rw-r--r-- | contributions.txt | 7 | ||||
-rw-r--r-- | languages/en.php | 10 | ||||
-rw-r--r-- | lib/resize.php | 88 | ||||
-rw-r--r-- | views/default/tidypics/forms/settings.php | 18 |
5 files changed, 75 insertions, 54 deletions
diff --git a/actions/settings.php b/actions/settings.php index e16e7960e..a4f102b89 100644 --- a/actions/settings.php +++ b/actions/settings.php @@ -57,9 +57,11 @@ $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'); diff --git a/contributions.txt b/contributions.txt index 2e09ca1cf..3cea54bd9 100644 --- a/contributions.txt +++ b/contributions.txt @@ -1,4 +1,4 @@ -See individual change logs for contributors to those builds
+Changelog and contributors list
------------------------------------------------------------------------
@@ -8,9 +8,14 @@ Release Date: 05/01/2010 BEGIN VERSION 1.6.8 CHANGES
------------------------------------------------------------------------
* New language strings: tidypics:nophotosingroup, tidypics:baduploadform
+ tidypics:settings:heading:img_lib, tidypics:settings:heading:main,
+ tidypics:settings:heading:river, tidypics:settings:heading:sizes,
+ tidypics:settings:heading:groups
* Fixed bug in titles of albums RSS
* Added a new css element: tidypics_line_break
* Fixed layout of album covers due to long titles or other text
+ * Fixed some bugs with image resizing when images are wide and short
+ * Improved interface of admin settings
------------------------------------------------------------------------
END VERSION 1.6.8 CHANGES
------------------------------------------------------------------------
diff --git a/languages/en.php b/languages/en.php index 30cef2db4..934c8ae5a 100644 --- a/languages/en.php +++ b/languages/en.php @@ -75,14 +75,20 @@ '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 diff --git a/lib/resize.php b/lib/resize.php index b0cfb8de3..857d0ba1c 100644 --- a/lib/resize.php +++ b/lib/resize.php @@ -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) { diff --git a/views/default/tidypics/forms/settings.php b/views/default/tidypics/forms/settings.php index 6cfed661f..21b85b83f 100644 --- a/views/default/tidypics/forms/settings.php +++ b/views/default/tidypics/forms/settings.php @@ -26,9 +26,10 @@ // 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'); @@ -115,6 +118,8 @@ $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 @@ -127,15 +132,18 @@ $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 .= 'width and height: <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 .= 'width and height: <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>'; // 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>"; |