Skip to content

Commit

Permalink
Fix url ID; add revsion to URL generation
Browse files Browse the repository at this point in the history
  • Loading branch information
GuLinux committed Oct 15, 2022
1 parent 7824eb4 commit 8a94c32
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# v1.0.7
## 15/10/2022

1. [](#new)
* Use revision for astrobin link URL

2. [](#bugfix)
* Fix astrobin link URL


# v1.0.6
## 11/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.6
version: 1.0.7
description: "This plugin provides astrobin shortcodes for images and galleries"
icon: picture-o
author:
Expand Down
9 changes: 7 additions & 2 deletions classes/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public function __construct($info, $api)
$revision_obj = $api->request($revision, [], false);
array_push($this->revisions, $revision_obj);
}
// dump($this);
}

public function id() {
Expand Down Expand Up @@ -69,8 +70,12 @@ public function url($format, $revision_type="final", $animated=false) {
return $url;
}

public function astrobinPage() {
return 'https://www.astrobin.com/' . $this->info->id;
public function astrobinPage($revision) {
$url = 'https://www.astrobin.com/' . ($this->info->hash ? $this->info->hash : $this->info->id);
if(!is_null($revision)) {
$url = $url . "#r" . $revision;
}
return $url;
}

public function description() {
Expand Down
2 changes: 1 addition & 1 deletion templates/partials/astrobin-image-lightbox.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h4 class="astrobin-lightbox-title">{{ image.title() }}</h4>
<div class="astrobin-lightbox-links">
<a href="{{ image.url('real', params['revision'], params['animated'] ) }}" target='_blank'><i class="fa fa-picture-o" aria-hidden="true"></i> Original version</a>
<a href="{{ image.astrobinPage() }}" target='_blank'><i class="fa fa-external-link" aria-hidden="true"></i> Astrobin technical details page</a>
<a href="{{ image.astrobinPage(params['revision']) }}" target='_blank'><i class="fa fa-external-link" aria-hidden="true"></i> Astrobin technical details page</a>
</div>
</figcaption>
<img src="{{ image.url(params['format_image_lightbox'], params['revision'], params['animated']) }}">
Expand Down

0 comments on commit 8a94c32

Please sign in to comment.