Giter VIP home page Giter VIP logo

kirby-getimage's Introduction

Kirby GetImage Plugin

GetImage is a KirbyCMS Plugin that hooks off the functionality of the Thumb plugin and allows the use of remote images with thumb();

How it Works

The Plugin downloads the specified image to the directory of the current page (e.g. a blog post).

This image object is then passed to thumb() to generate a thumbnail with the specified options, and can be outputted as an URL (or <img> tag from either the root URL or another URL e.g. a CDN such as Amazon Cloudfront).

Usage

Currently, the only way I have found to pass the $page variable is through a function argument, so this is the reason for the first argument. Hopefully it will be taken out in subsequent releases!

getimage($page, $imgurl, $options[, $tag])

$page

is the $page variable containing the information about the page that the image will be saved to (hopefully will be removed in the future)

$imgurl

is the URL of the image that you want to save

$options

is an array containing the information to be passed along to thumb() and also an extra 'cdn' array key, where you can specify another URL for the images to be hosted from

$tag (optional)

is a boolean value stating whether the returned text contains the ing tag or just the URL to the image

Example Usage

  getimage($page, 'http://img.youtube.com/vi/oHg5SJYRHA0/maxresdefault.jpg', array('height'=>'300', 'width'=>'984', 'crop'=>true, 'cdn'=>'http://cdn.test.com', 'fallback'=>'hqdefault.jpg'), false);

would produce something like this: http://cdn.test.com/thumbs/3b20166aa8acef1a4eeb36f46d4ab3ed.984.300.0.1.0.100.jpg?1369859345

(due to the nature of thumb(), there is no need for echo as it doesn't seem to work when returned)

kirby-getimage's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

sulcalibur

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.