Short Version
thumb()
doesn’t appear to work with external images. Is this intentional, or something to do with my PHP or Kirby setup?
Long Version
I am running a portfolio site with Kirby. As part of this, I am returning the thumbnail url of a Vimeo video using this code:
<?php
$hash = unserialize(file_get_contents("http://vimeo.com/api/v2/video/".$item->videoID().".php"));
$img = $hash[0]['thumbnail_large'] ?>
<img src="<?php echo $img ?>" class="img-responsive" />
However, when attempting to pass the $img
variable to thumb()
, Kirby returns nothing - no error code, no <img>
tag, nothing.
To test this, I have also attempted passing a static external URL to thumb()
:
<?php $test = 'http://1.bp.blogspot.com/-QZScgcWodAg/UZu0R2DaJOI/AAAAAAAAAIw/57rwaNQNyx8/s1600/Sunrise+landscape+render+retouches.png' ?>
<?php echo thumb($test, array('width' => 400))->url(); ?>
With the same result: nothing, no error, no code.
Hypotheses
thumb()
Requires an Image Object
Looking through the Kirby Cheat Sheet, the one-line description of thumb()
states:
thumb($image, $params = array())
Creates a thumbnail for a given image object
Is the possible problem that I am passing a URL, a string, rather than an image object? If so, is it possible to transform that string into an image object?
thumb()
Cannot work with external URLs
Something about the way either the thumb()
function is written, or how Kirby or PHP is configured is preventing the processing of external URLs in the manner.