# Thumbnails with external images

**URL:** <https://forum.getkirby.com/t/thumbnails-with-external-images/874>\
**Category:** Questions\
**Tags:** v2\
**Created:** [April 23, 2015, 12:33am UTC](https://forum.getkirby.com/t/thumbnails-with-external-images/874 "2015-04-23T00:33:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nchpmn](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/nchpmn/32/471_2.png) [@nchpmn](https://forum.getkirby.com/u/nchpmn)\
**Post date:** [April 23, 2015, 12:33am UTC](https://forum.getkirby.com/t/thumbnails-with-external-images/874/1 "2015-04-23T00:33:02Z")

</div>

# 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:

```auto
<?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()`:

```auto
<?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.

---

<div class="post-metadata">

**Author:** ![Malvese](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/malvese/32/12375_2.png) [@Malvese](https://forum.getkirby.com/u/Malvese)\
**Post date:** [April 23, 2015, 8:51am UTC](https://forum.getkirby.com/t/thumbnails-with-external-images/874/2 "2015-04-23T08:51:02Z")

</div>

You probably have to save the image locally, then use thumb().  
Also, I think retrieving an external image every time would be a lot slower.

---

<div class="post-metadata">

**Author:** ![jordimol](https://avatars.discourse-cdn.com/v4/letter/j/f9ae1b/32.png) [@jordimol](https://forum.getkirby.com/u/jordimol)\
**Post date:** [February 19, 2016, 11:57am UTC](https://forum.getkirby.com/t/thumbnails-with-external-images/874/3 "2016-02-19T11:57:13Z")

</div>

Same problem here ☹

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [February 19, 2016, 12:09pm UTC](https://forum.getkirby.com/t/thumbnails-with-external-images/874/4 "2016-02-19T12:09:36Z")

</div>

As @Malvese wrote, it doesn’t make much sense to download the external image each time. You can download it programmatically once and then create thumbs.

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:00pm UTC](https://forum.getkirby.com/t/thumbnails-with-external-images/874/5 "2025-02-06T17:00:09Z")

</div>

Archived on February 6, 2025, 5:00pm UTC


