Current size as default for resize, if default is otherwise 0 - #281
This commit is contained in:
parent
dcb51ba4ff
commit
f4a49b2fb1
@ -40,7 +40,7 @@ class ResizeImage extends Extension {
|
||||
global $user, $config;
|
||||
if($user->is_admin() && $config->get_bool("resize_enabled")) {
|
||||
/* Add a link to resize the image */
|
||||
$event->add_part($this->theme->get_resize_html($event->image->id));
|
||||
$event->add_part($this->theme->get_resize_html($event->image));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,16 +4,19 @@ class ResizeImageTheme extends Themelet {
|
||||
/*
|
||||
* Display a link to resize an image
|
||||
*/
|
||||
public function get_resize_html(/*int*/ $image_id) {
|
||||
public function get_resize_html(Image $image) {
|
||||
global $user, $config;
|
||||
|
||||
$i_image_id = int_escape($image_id);
|
||||
$i_image_id = int_escape($image->id);
|
||||
$default_width = $config->get_int('resize_default_width');
|
||||
$default_height = $config->get_int('resize_default_height');
|
||||
|
||||
if(!$default_width) $default_width = $image->width;
|
||||
if(!$default_height) $default_height = $image->height;
|
||||
|
||||
$html .= "
|
||||
".make_form(make_link('resize/'.$i_image_id), 'POST')."
|
||||
<input type='hidden' name='image_id' value='$i_image_id'>
|
||||
$html = "
|
||||
".make_form(make_link("resize/{$image->id}"), 'POST')."
|
||||
<input type='hidden' name='image_id' value='{$image->id}'>
|
||||
<input id='resize_width' style='width: auto;' size='5' name='resize_width' type='text' value='".$default_width."'> x
|
||||
<input id='resize_height' style='width: auto;' size='5' name='resize_height' type='text' value='".$default_height."'>
|
||||
<input id='resizebutton' type='submit' value='Resize'>
|
||||
|
Loading…
x
Reference in New Issue
Block a user