Creating new barebones plugin imgcache.
Eventually this will download and cache external images. Starting work on #27.
This commit is contained in:
parent
2026e4a872
commit
0f302ec5ba
32
www/plugins/jasonwilliams/imgcache/Plugin.php
Normal file
32
www/plugins/jasonwilliams/imgcache/Plugin.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php namespace JasonWilliams\ImgCache;
|
||||
|
||||
/**
|
||||
* The plugin.php file (called the plugin initialization script) defines the plugin information class.
|
||||
*/
|
||||
|
||||
use System\Classes\PluginBase;
|
||||
|
||||
class Plugin extends PluginBase
|
||||
{
|
||||
|
||||
public function pluginDetails()
|
||||
{
|
||||
return [
|
||||
'name' => 'Image Cache',
|
||||
'description' => 'Saves external images locally and presents them via a twig filter.',
|
||||
'author' => 'Jason Williams',
|
||||
'icon' => 'oc-icon-cloud'
|
||||
];
|
||||
}
|
||||
|
||||
public function registerMarkupTags()
|
||||
{
|
||||
return [
|
||||
'filters' => [
|
||||
'imgcache' => function($imgurl) {
|
||||
return $imgurl;
|
||||
}
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
6
www/plugins/jasonwilliams/imgcache/plugin.yaml
Normal file
6
www/plugins/jasonwilliams/imgcache/plugin.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
plugin:
|
||||
name: 'Image Cache'
|
||||
description: 'Saves external images locally and presents them via a twig filter.'
|
||||
author: 'Jason Williams'
|
||||
icon: oc-icon-cloud
|
||||
homepage: 'https://ja.son-williams.ca/'
|
1
www/plugins/jasonwilliams/imgcache/updates/version.yaml
Normal file
1
www/plugins/jasonwilliams/imgcache/updates/version.yaml
Normal file
@ -0,0 +1 @@
|
||||
0.0.1: Initial version
|
@ -13,7 +13,8 @@
|
||||
<div class="{{ feeditemclass }}" data-timestamp="{{ post.timestamp }}">
|
||||
<div class="card">
|
||||
{% if post.extra.img %}
|
||||
<img class="card-img-top" src="{{ post.extra.img }}">
|
||||
<!-- <img class="card-img-top" src="{{ post.extra.img }}"> -->
|
||||
<img class="card-img-top" src="{{ post.extra.img | imgcache }}">
|
||||
{% elseif post.extra.lat %}
|
||||
<img class="card-img-top" src="https://api.mapbox.com/styles/v1/jason32dev/ckgehopjc2o1y19o09aqs4x11/static/pin-l+B05C71({{ post.extra.lng }},{{ post.extra.lat }})/{{ post.extra.lng }},{{ post.extra.lat }},14,0/545x300@2x?access_token=pk.eyJ1IjoiamFzb24zMmRldiIsImEiOiJjazFsNHd5djcwMXptM2htbW8zM3MyZGxuIn0.-TtNNGFysQPQRfGR1P8DUA">
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user