Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downloading Images from an https protocol #22

Open
leikxile opened this issue Mar 31, 2014 · 6 comments
Open

Downloading Images from an https protocol #22

leikxile opened this issue Mar 31, 2014 · 6 comments

Comments

@leikxile
Copy link

Hi Grandt,

I think downloading images from an https protocol is not allowed? i've tried downloading the same image from an https site and an http site. The image is downloaded from the http site, but the image fails to download from the https site.

@Grandt
Copy link
Owner

Grandt commented Mar 31, 2014

I hadn't thought of testing that possibility, I should have.

I'll test. Do you by any chance have a link you know won't work? Or is it all https links?

@leikxile
Copy link
Author

All https links I guess, I tried 8 images from google images which has an https protocol and none of those have been downloaded. You may try this link https://lfe-cdn.lytro.com/lfe/b4817688-286e-11e2-9fef-12313904d542/carousel_preview.jpg

@Grandt
Copy link
Owner

Grandt commented Mar 31, 2014

I'm late for work already, so I have to test later. In the mean time, try to replace the curl_setopt lines in getFileContents with these lines:

        curl_setopt($ch, CURLOPT_HEADER         , 0); 
        curl_setopt($ch, CURLOPT_URL            , str_replace(" ","%20",$source));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER , true);
        curl_setopt($ch, CURLOPT_BUFFERSIZE     , 4096);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION , true);     // follow redirects
        curl_setopt($ch, CURLOPT_ENCODING       , "");       // handle all encodings
        curl_setopt($ch, CURLOPT_USERAGENT      , "EPub (Version " . self::VERSION . ") by A. Grandt"); // who am i
        curl_setopt($ch, CURLOPT_AUTOREFERER    , true);     // set referer on redirect
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT , 120);      // timeout on connect
        curl_setopt($ch, CURLOPT_TIMEOUT        , 120);      // timeout on response
        curl_setopt($ch, CURLOPT_MAXREDIRS      , 10);       // stop after 10 redirects
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER , false);    // Disabled SSL Cert checks

@leikxile
Copy link
Author

leikxile commented Apr 1, 2014

Thank you issue has been fixed. BTW i'm working on the processChapterImages function to download background images from other elements. Because it only downloads images from the image tag right? I'll send it to you when its done because I still don't know how to use Github :)

@Grandt
Copy link
Owner

Grandt commented Apr 1, 2014

Right now it only uses the img tag. ePub2 really doens't support the other tags. ePub3 does. It also downloads and adds images defined in the CSS files, though not from "inlined" CSS, or style attributes.

Please send me what you are done. The email is as always [email protected]

@leikxile
Copy link
Author

leikxile commented Apr 1, 2014

Ok thanks for the heads up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants