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

Feature Request: Use URL to specify Cover image #9

Closed
dteviot opened this issue Jun 22, 2016 · 9 comments
Closed

Feature Request: Use URL to specify Cover image #9

dteviot opened this issue Jun 22, 2016 · 9 comments

Comments

@dteviot
Copy link
Owner

dteviot commented Jun 22, 2016

(Request by "Guest")

On the topic of cover issues with the extension, could I make a suggestion, to allow the setting of covers using an image from any URL instead of just those available on the page?

For example, take this page

https://www.baka-tsuki.org/project/index.php?title=The_Zashiki_Warashi_of_Intellectual_Village:Volume9

As visible on that page itself (and therefore available for packing by the extension), the closest one can get to a cover would be

https://www.baka-tsuki.org/project/images/3/31/Zashiki_v09_000.jpg

However, this is too wide as it includes the front cover, the spine, and the back cover as well.
If on the other hand one were to check the main series page,

https://www.baka-tsuki.org/project/index.php?title=The_Zashiki_Warashi_of_Intellectual_Village

there is a much better option available to act as a cover, not present on the volume's full text page.

https://www.baka-tsuki.org/project/images/3/30/Zashiki_Volume_9_Cover.jpg

As-is, the extension does not allow for setting this as the cover, and therefore the epub needs to be manually tweaked after the fact to replace the cover.

Since I'm uncertain if there is any practical easy one-size-fits-all fix to somehow magically detect the presence of a cover image on a page other than the one being viewed, then a solution could be to allow entering an image URL to fetch a specific image to act as cover.

@belldandu
Copy link
Collaborator

belldandu commented Jun 22, 2016

I will look into this a bit later.

Some pages appear to have the smaller cover and the wide cover within the novel illustrations while others do not. Sure this can be fixed easily once imageInfo.isCover is actually set to true somewhere.

Aside from that i think this will be fairly easy to implement a simple check for if a smaller cover already exists for the book. (only issue here is inconsistent file names)

And of course url support for the cover if you find one on the net when there isn't one on the site your getting the book from.

@belldandu
Copy link
Collaborator

belldandu commented Jun 23, 2016

At this point after extensively looking into this. The best option would be to provide an option for a custom cover url. This url should be passed into the images array like the rest of the images however so that all the checks can go through.

I will be making a seperate pull request from #10 to do this.

@dteviot
Copy link
Owner Author

dteviot commented Jul 4, 2016

Initial version implemented in version 0.0.0.9.
Needs more work for extracting the file name from the supplied URL. Some cases don't work.
There are three cases for Baka Tsuki images.

Only the first one works correctly.

@belldandu
Copy link
Collaborator

@dteviot I recommend using this http://blog.teamtreehouse.com/reading-files-using-the-html5-filereader-api here https://github.com/dteviot/WebToEpub/blob/sonako/plugin/js/parsers/ImageCollector.js#L306 to get the image name and type from the file itself along with its width and height.

I've added myself to assignees for this as well.

@belldandu belldandu self-assigned this Jul 4, 2016
@belldandu
Copy link
Collaborator

Using the filereader api will also get rid of the need for complex regex's that might fail under certain conditions.

@belldandu
Copy link
Collaborator

The above might be a bad idea though. I am still looking into other options.

@dteviot
Copy link
Owner Author

dteviot commented Jul 5, 2016

@belldandu
This works for the failing cases, but it's kind of ugly. fc13f84
I guess it will do for the moment.

@dteviot
Copy link
Owner Author

dteviot commented Jul 9, 2016

I'm going to call this done.

@belldandu
Copy link
Collaborator

Yeah seems to work for now.

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

No branches or pull requests

2 participants