Jump to content

Grabbing non-local image file


bpops

Recommended Posts

I am interested in the automation of grabbing an image from another website and saving it to my own. Currently, I'm doing something like

 

<?php

  //URL for image
  $cover = 'URL_HERE'

  //Open this Image
  if($im = @imagecreatefromjpeg($cover)){

    //Save image to my server
    imagejpeg($im, dirname(__FILE__).'/covers/'.$id.'.jpg');

  }
?>

 

The problem with this lies in that the image is being opened and resaved... hence the quality is lowered. How can I just grab the original file without any loss of quality? Is there another non-image-specific function I could use?

Link to comment
https://forums.phpfreaks.com/topic/97725-grabbing-non-local-image-file/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.