Create file from url

It’s a pain to get thumbnails for Vimeo videos so I’ve connected to their API and am trying to save a thumbnail image from Vimeo to Kirby. I’m almost there but am getting the error The media type for "....jpg" cannot be detected.

Does $page->createFile() allow creation of files from urls? Wish I could tell it that the MIME is jpg or similar. The main reason I need to saved is so I can crop it to the right size before displaying on the page.

You could try using using php get file contents $vidimage = file_get_contents(''); and then use F::write to put it on disk.

Thats how i ripped Jpegs from mp3 files and stored them in the panel. It supports URL’s should work fine.

1 Like