I want to save the images from google plus as below url it is work as well in local computer but I got below error when upload to ubuntu14.
$image = Image::make('https://lh6.googleusercontent.com/-Gcp_Wjj7yA0/AAAAAAAAAAI/AAAAAAAAAB8/hl1xcz4FnEI/photo.jpg')
            ->resize(100, 100)->save(public_path('image/userface/fuck.jpg'));
Errors
Unable to init from given url
                I have found a workaround for this problem. When we re-fetch the image, 99% it works, so i modified saving function to try to save for 3 times if it fails even then, we abort.
    $flag = true;
    $try = 1;
    while ($flag && $try <= 3):
        try {
            Image::make($path)->save(public_path("{$public_app_path}/" . $filename));
            //Image migrated successfully
            $flag = false;
        } catch (\Exception $e) {
            //not throwing  error when exception occurs
        }
        $try++;
    endwhile;
                        In Image Intervention Package Parameters, that can be read by below URL.
http://image.intervention.io/api/make
2nd Point:- That URL of an image (allow_url_fopen must be enabled).
So please check that, the Image you are dealing with hosted on server that have allow_url_fopen PHP.INI directive enabled.
You can check whether it enabled or not by simple a single php statement as below.
echo ini_get('allow_url_fopen') ? 'Enabled' : 'Disabled';
If It is found disabled, please enabled it and then check. It works !!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With