* @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;
// move this out of library
register_error(elgg_echo('tidypics:nosettings'));
forward($_SERVER['HTTP_REFERER']);
- return false;
+ return FALSE;
}
$image_sizes = unserialize($image_sizes);
$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;
$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);
$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;
}
/**
* @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);
// 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,
* @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);
$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;
$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;
$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;
unset($thumb);
- return true;
+ return TRUE;
}
* @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);
* @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);
$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;
$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;
$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;
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
* @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) {
// 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,
}
// 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>";
$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" /> ';
$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>";