diff --git a/ext/handle_ico/theme.php b/ext/handle_ico/theme.php index 9f68cc53..36daa9c2 100644 --- a/ext/handle_ico/theme.php +++ b/ext/handle_ico/theme.php @@ -4,7 +4,8 @@ class IcoFileHandlerTheme extends Themelet { public function display_image(Page $page, Image $image) { $ilink = $image->get_image_link(); $html = " - + main image "; $page->add_block(new Block("Image", $html, "main", 10)); } diff --git a/ext/handle_pixel/script.js b/ext/handle_pixel/script.js index b85094cc..e127e42f 100644 --- a/ext/handle_pixel/script.js +++ b/ext/handle_pixel/script.js @@ -1,5 +1,7 @@ $(function() { - function zoom(zoom_type) { + function zoom(zoom_type, save_cookie) { + save_cookie = save_cookie === undefined ? true : save_cookie; + var img = $('.shm-main-image'); if(zoom_type == "full") { @@ -21,14 +23,21 @@ $(function() { $(".shm-zoomer").val(zoom_type); - Cookies.set("ui-image-zoom", zoom_type, {expires: 365}); + if (save_cookie) { + Cookies.set("ui-image-zoom", zoom_type, {expires: 365}); + } } $(".shm-zoomer").change(function(e) { zoom(this.options[this.selectedIndex].value); }); + $(window).resize(function(e) { + $(".shm-zoomer").each(function (e) { + zoom(this.options[this.selectedIndex].value, false) + }); + }); - $(".shm-main-image").click(function(e) { + $("img.shm-main-image").click(function(e) { switch(Cookies.get("ui-image-zoom")) { case "full": zoom("width"); break; default: zoom("full"); break; diff --git a/ext/handle_svg/main.php b/ext/handle_svg/main.php index 872d59d4..6db9ad1d 100644 --- a/ext/handle_svg/main.php +++ b/ext/handle_svg/main.php @@ -101,6 +101,9 @@ class MiniSVGParser { /** @var int */ public $height=0; + /** @var int */ + private $xml_depth=0; + /** @param string $file */ function __construct($file) { $xml_parser = xml_parser_create(); @@ -110,13 +113,15 @@ class MiniSVGParser { } function startElement($parser, $name, $attrs) { - if($name == "SVG") { + if($name == "SVG" && $this->xml_depth == 0) { $this->width = int_escape($attrs["WIDTH"]); $this->height = int_escape($attrs["HEIGHT"]); } + $this->xml_depth++; } function endElement($parser, $name) { + $this->xml_depth--; } } diff --git a/ext/handle_svg/theme.php b/ext/handle_svg/theme.php index 76d76aa3..8e87ee1d 100644 --- a/ext/handle_svg/theme.php +++ b/ext/handle_svg/theme.php @@ -5,8 +5,8 @@ class SVGFileHandlerTheme extends Themelet { $ilink = make_link("get_svg/{$image->id}/{$image->id}.svg"); // $ilink = $image->get_image_link(); $html = " - - + + "; $page->add_block(new Block("Image", $html, "main", 10)); diff --git a/ext/handle_video/theme.php b/ext/handle_video/theme.php index 159283b1..171582d5 100644 --- a/ext/handle_video/theme.php +++ b/ext/handle_video/theme.php @@ -42,7 +42,12 @@ class VideoFileHandlerTheme extends Themelet { $html .= $html_fallback; } else { $html .= " -