Jump to content

Grabbing images from a URL - without having a page


chrizz
 Share

Recommended Posts

hey, 

a quick question about importing images from an external URL: I know that this is possible in general (at least that's what a forum search told me). My use case is slighty different and I am just curious if there's a way to achieve the following: 

I am currently writing a module which shows external news from Facebook which could contain an image. The news are simply cached in the database - there is no page created from it. What I want to make use of are the handy image functions to crop and resize images coming from FB - *without* having a page. 

Is this even possible? If yes: awesome. If not, I guess the most promising workaround would be having a hidden page somewhere acting as image container for such posts

as usual: happy to hear your thoughts on that one ?

Link to comment
Share on other sites

  • 2 weeks later...

You can use the ImageSizer class, rough example assuming you already have saved the image on disk:

$fullpath = "/var/www/images/someimage.jpg";
$options = array('upscaling' => false, 'quality' => 100, 'sharpening' => 'soft');
$imageSizer = new ImageSizer($fullPath, $options);
$success = $imageSizer->resize(100, 200); 

 

  • Like 3
Link to comment
Share on other sites

  • 4 weeks later...

sorry for getting back to you guys this late and thanks for all your input. Using ImageSizer directly sounds pretty handy - although I have to tell you, that for my particular case, I have decided to just create a hidden page which acts as a container. So exactly the opposite what I was looking for, but in the end this approach turned out to be the most efficient one ? Anyways: Thanks a lot!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...