Proof of Concept

DiskuteraLibraryThing API Development

Bara medlemmar i LibraryThing kan skriva.

Proof of Concept

Denna diskussion är för närvarande "vilande"—det sista inlägget är mer än 90 dagar gammalt. Du kan återstarta det genom att svara på inlägget.

1MMcM
Redigerat: jul 6, 2008, 3:27 pm

More annoying than useful, but a quick example in the spirit of what Tim's thinking about, I believe:

http://home.comcast.net/~mmcm/lthacks/CoverFlip.htm

2timspalding
jul 6, 2008, 4:15 pm

You kidding, that's cool!

I'm in a car right now—wimax—with no time to look at the code. I'm sure it's very cool.

3wimble
Redigerat: jul 7, 2008, 1:55 pm

Thanks for giving me somewhere to start from. And with apologies for blatantly copying your basic structure: http://www.librarything.com/talktopic.php?topic=40698#679169

4MMcM
jul 7, 2008, 2:39 pm

No apology necessary; that's the point of sharing source.

5goddardlibrary
jul 10, 2008, 10:24 am

This is VERY cool! Is there a simple way in the code to change the size of the book cover image. Right now it looks a little squashed.

6MMcM
jul 10, 2008, 10:40 am

The original images aren't all the same size, so to make them fill the same box, they need to be squashed or stretched.
The alternative is to float or crop them, but then the effect is somewhat lost (as it is by changing the size of the box every page).
Maybe I'm overlooking something.

7conceptDawg
jul 10, 2008, 10:50 am

Just float the image in the middle of a "sheet" of the book. Just like if the cover image were printed on a page.

8MMcM
Redigerat: jul 10, 2008, 11:57 am

The effect you want while turning the page is that the image is horizontally compressed. For example, when you're 60° over, you want the image to be half the width. If you're floating, that means half the width it would be when not compressed (half the image; half the margins). When I was experimenting with this, I could not see a way to do that without knowing the original size of the image; that is, using only align and style. What I could do is not compress the image or compress it within the full page and then float it when the page landed; as I said in #6, these lost to the effect for me.

Perhaps I missed something obvious; I only spent a little bit of time on this.
Maybe the results could include the cover properties. Does it know them when it's Amazon's?

9timspalding
jul 10, 2008, 5:46 pm

>8 MMcM:

It doesn't know the size, unfortunately. But JavaScript can get the size of all loaded images.

10MMcM
Redigerat: jul 12, 2008, 12:12 am

Yeah, you're right. I can set the image source and then get the size when its onload fires. For IE, it pretty much has to be a hidden image so that its width/height only reflects the image. With FF, I could use the displayed image element and then adjust the style based on the naturalWidth/Height, properties beyond the common standard.