diff --git a/CHANGELOG.md b/CHANGELOG.md index 92bde6a..b9514e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.0.3 +## 30/08/2017 + +1. [](#new) + * New parameter `animated=true` to display gif as animated when using regular, real and hd formats + # v1.0.2 ## 28/08/2017 diff --git a/README.md b/README.md index af83958..2a94992 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ This is a list for each shortcode. * `image_class`: extra css classes for the main image html tag. * `image_lightbox_class`: extra css classes for the main lightbox html tag. * `revision`: image revision to load. It can be "final", "original", or an uppercase letter corresponding to the revision letter of the astrobin technical page (A, B, C, etc). + * `animated`: set to true if you want to display gif animation instead of the preview static image. * astrobin-collection * `collection_title_tag`: HTML tag to use for the collection title. * `collection_description_tag`: HTML tag to use for the collection description. diff --git a/blueprints.yaml b/blueprints.yaml index a74b58b..dca60f8 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,5 +1,5 @@ name: Astrobin -version: 1.0.2 +version: 1.0.3 description: "This plugin provides astrobin shortcodes for images and galleries" icon: picture-o author: diff --git a/classes/AstrobinCommons.php b/classes/AstrobinCommons.php index 0ae9d61..a668b19 100644 --- a/classes/AstrobinCommons.php +++ b/classes/AstrobinCommons.php @@ -9,7 +9,8 @@ static function defaultParams() { 'format_image_lightbox' => 'hd', 'collection_title_tag' => 'h3', 'collection_description_tag' => 'h5', - 'revision' => 'final' + 'revision' => 'final', + 'animated' => false ]; } } diff --git a/classes/Image.php b/classes/Image.php index 381db7d..c37d64c 100644 --- a/classes/Image.php +++ b/classes/Image.php @@ -34,7 +34,7 @@ public function datetaken() { return NULL; } - public function url($format, $revision_type="final") { + public function url($format, $revision_type="final", $animated=false) { $revision_obj = NULL; if($revision_type == "final") { foreach($this->revisions as $revision) { @@ -53,7 +53,11 @@ public function url($format, $revision_type="final") { } } } - return $revision_obj->{'url_' . $format}; + $url = $revision_obj->{'url_' . $format}; + if($animated) { + $url .= '?animated'; + } + return $url; } public function astrobinPage() { diff --git a/templates/partials/astrobin-image-lightbox.html.twig b/templates/partials/astrobin-image-lightbox.html.twig index 23fe1b4..b9b4793 100644 --- a/templates/partials/astrobin-image-lightbox.html.twig +++ b/templates/partials/astrobin-image-lightbox.html.twig @@ -2,11 +2,11 @@

{{ image.title() }}

- +
{{ image.description()|replace({"\n": "
"}) }}
diff --git a/templates/partials/astrobin-image.html.twig b/templates/partials/astrobin-image.html.twig index 64a33da..a7bdf6b 100644 --- a/templates/partials/astrobin-image.html.twig +++ b/templates/partials/astrobin-image.html.twig @@ -1,6 +1,6 @@
- +
{{ image.title() }}