diff options
Diffstat (limited to 'modules/gallery/models')
| -rw-r--r-- | modules/gallery/models/item.php | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index 7fc37325..4d05e4da 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -671,10 +671,23 @@ class Item_Model extends ORM_MPTT { */ public function movie_img($extra_attrs) { $v = new View("movieplayer.html"); - $v->attrs = array_merge($extra_attrs, - array("style" => "display:block;width:{$this->width}px;height:{$this->height}px")); + $max_size = module::get_var("gallery", "resize_size", 640); + $width = $this->width; + $height = $this->height; + if ($width > $max_size || $height > $max_size) { + if ($width > $height) { + $height *= $max_size / $width; + $width = $max_size; + } else { + $width *= $max_size / $height; + $height = $max_size; + } + } + + $v->attrs = array_merge($extra_attrs, array("style" => "width:{$width}px;height:{$height}px", + "class" => "g-movie")); if (empty($v->attrs["id"])) { - $v->attrs["id"] = "g-movie-id-{$this->id}"; + $v->attrs["id"] = "g-item-id-{$this->id}"; } return $v; } @@ -944,6 +957,7 @@ class Item_Model extends ORM_MPTT { $data["resize_url"] = $tmp; } $data["thumb_url"] = $this->thumb_url(true); + $data["can_edit"] = access::can("edit", $this); // Elide some internal-only data that is going to cause confusion in the client. foreach (array("relative_path_cache", "relative_url_cache", "left_ptr", "right_ptr", |
