streamline resize image process

This commit is contained in:
Shish 2012-08-18 21:09:40 +01:00
parent 216dada347
commit 0d2c78939e
3 changed files with 8 additions and 42 deletions

View File

@ -144,9 +144,6 @@ class ResizeImage extends Extension {
} catch (ImageResizeException $e) { } catch (ImageResizeException $e) {
$this->theme->display_resize_error($page, "Error Resizing", $e->error); $this->theme->display_resize_error($page, "Error Resizing", $e->error);
} }
} else {
/* Display options for resizing */
$this->theme->display_resize_page($page, $image_id);
} }
} }
} }

View File

@ -1,5 +0,0 @@
form#form_resize {
float: left;
margin: 0;
width: 60%;
}

View File

@ -8,11 +8,15 @@ class ResizeImageTheme extends Themelet {
global $user, $config; 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');
$html = " $html .= "
".make_form(make_link("resize"),'POST',false,'resize_image')." ".make_form(make_link('resize/'.$i_image_id), 'POST')."
<input type='hidden' name='image_id' value='$i_image_id' /> <input type='hidden' name='image_id' value='$i_image_id'>
<input type='submit' value='Resize' id='resize_image_submit' /> <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'>
</form> </form>
"; ";
@ -25,35 +29,5 @@ class ResizeImageTheme extends Themelet {
$page->add_block(new NavBlock()); $page->add_block(new NavBlock());
$page->add_block(new Block($title, $message)); $page->add_block(new Block($title, $message));
} }
public function display_resize_page(Page $page, /*int*/ $image_id) {
global $config;
$default_width = $config->get_int('resize_default_width');
$default_height = $config->get_int('resize_default_height');
$image = Image::by_id($image_id);
$thumbnail = $this->build_thumb_html($image, null);
$html = "<div style='clear:both;'></div>
<p>Resize Image ID ".$image_id."<br>".$thumbnail."</p>
<p>Please note: You will have to refresh the image page, or empty your browser cache.</p>
<p>Enter the new size for the image, or leave blank to scale the image automatically.</p><br>"
.make_form(make_link('resize/'.$image_id), 'POST', $multipart=True,'form_resize')."
<input type='hidden' name='image_id' value='$image_id'>
<table id='large_upload_form'>
<tr><td>New Width</td><td colspan='3'><input id='resize_width' name='resize_width' type='text' value='".$default_width."'></td></tr>
<tr><td>New Height</td><td colspan='3'><input id='resize_height' name='resize_height' type='text' value='".$default_height."'></td></tr>
<tr><td colspan='4'><input id='resizebutton' type='submit' value='Resize'></td></tr>
</table>
</form>
";
$page->set_title("Resize Image");
$page->set_heading("Resize Image");
$page->add_block(new NavBlock());
$page->add_block(new Block("Resize Image", $html, "main", 20));
}
} }
?> ?>