Skip to content

Commit

Permalink
Fix revision detection algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
GuLinux committed Oct 18, 2022
1 parent 8a94c32 commit d2495a2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# v1.0.8
## 18/10/2022

1. [](#bugfix)
* Fix revision selection algorithm


# v1.0.7
## 15/10/2022

Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Astrobin
version: 1.0.7
version: 1.0.8
description: "This plugin provides astrobin shortcodes for images and galleries"
icon: picture-o
author:
Expand Down
4 changes: 3 additions & 1 deletion classes/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function datetaken() {

public function url($format, $revision_type="final", $animated=false) {
$revision_obj = NULL;
// dump($revision_type);
if($revision_type == "final") {
foreach($this->revisions as $revision) {
if($revision->is_final) {
Expand All @@ -52,7 +53,7 @@ public function url($format, $revision_type="final", $animated=false) {
foreach($this->revisions as $revision) {
$this->grav['debugger']->addMessage(' - Revision: ');
$this->grav['debugger']->addMessage($revision);
if(property_exists($revision, 'label')) {
if(property_exists($revision, 'label') && $revision->label == $revision_type) {
$this->grav['debugger']->addMessage('Revision label: ' . $revision->label);
$revision_obj = $revision;
break;
Expand All @@ -63,6 +64,7 @@ public function url($format, $revision_type="final", $animated=false) {
$revision_obj = $this->revisions[0];
}
}
// dump($revision_obj);
$url = $revision_obj->{'url_' . $format};
if($animated) {
$url .= '?animated';
Expand Down

0 comments on commit d2495a2

Please sign in to comment.