bpops Posted March 25, 2008 Share Posted March 25, 2008 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 More sharing options...
cooldude832 Posted March 25, 2008 Share Posted March 25, 2008 file_get_contents and then create it from a string instead using the file_get_contents as the binary of it Link to comment https://forums.phpfreaks.com/topic/97725-grabbing-non-local-image-file/#findComment-500070 Share on other sites More sharing options...
bpops Posted March 25, 2008 Author Share Posted March 25, 2008 I'm not sure I follow... You mean to grab the file with $file = file_get_contents($url); Then create the new file how? Link to comment https://forums.phpfreaks.com/topic/97725-grabbing-non-local-image-file/#findComment-500073 Share on other sites More sharing options...
bpops Posted March 25, 2008 Author Share Posted March 25, 2008 Does anyone else have any ideas? I feel like this should be an easy thing to do, but I just can't figure it out. It seems that all the image routines resample the images no matter what. Link to comment https://forums.phpfreaks.com/topic/97725-grabbing-non-local-image-file/#findComment-500092 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.