Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Some Amazon db graphics unprintable. How they do that?

Some Amazon db graphics unprintable. How they do that?
Thread Tools
Love Calm Quiet
Mac Elite
Join Date: Mar 2001
Location: CO
Status: Offline
Reply With Quote
Dec 11, 2004, 11:07 AM
 
I used to be able to drag a .jpg of of book cover or page from table of contents onto the desktop - or into another browser window. Now amazon is doing ?something? else that (intentionally?) prevents this (I have to go to trouble of a partial screen shot).

I'm guessing that their motivation is copyright protection, because this new change also makes the graphic not print(!) (I've tried Safari & IE-Mac).

If you're not sure what I mean, look at page:
http://www.amazon.com/gp/reader/0596005253

Try printing it. Do you (like me) end up with the 'handles' on each side of the image 'closing' together in the printed version - but no book cover image in between. Print to pdf gives same result.

The annoyance with amazon is a small thing... but I'm mostly curious about what web technology they use to achieve this. I can't even *find* the image when I look at the source for the page. Something peculiar to .asp dbs maybe? I'm a web db newbie (just a little PHP), so please explain in lay terms?! TIA
TOMBSTONE: "He's trashed his last preferences"
     
Phil Sherry
Dedicated MacNNer
Join Date: Nov 2004
Location: Stockholm, Sweden
Status: Offline
Reply With Quote
Dec 11, 2004, 11:55 AM
 
by jingo, can someone please explain what this new-fangled "JavaScript" is?

only Black Book can save us now!
     
Synotic
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Dec 11, 2004, 12:02 PM
 
Well I basically copied all the code on the page and the dumped into SubEthaEdit with live preview on and cut out all the code on either side of the image. After cutting out most of the crap I got:

Code:
<script language="JavaScript1.1" type="text/javascript"> <!-- function si_displayCurrentImg () { document.writeln('<img src="http://g-images.amazon.com/images/G/01/x-locale/common/transparent-pixel.gif" height="669" border="1" width="500" />'); } // --> </script> <table> <tr> <td background="http://lookinside2-images.amazon.com/Qffs+v35leqSQJPI/P+OW4RN9pZ+4oDlBgTYAU4scYVB9WA7DEWmJkXBKCmgDNxe"> <script language="JavaScript1.1" type="text/javascript"> <!-- si_displayCurrentImg(); //--> </script> </td> </tr> </table>
Basically what they do is set a table cell's background with the current page's image. But they don't set any width or height. So it collapses on itself, effectively showing nothing. However, with JavaScript enabled, it inserts, using writeIn, a transparent image that is the same height as the page, stretching the cell and revealing the book's page. The "easiest" way I can think of capturing the image(s) write now is opening up the code and doing a search for "lookinside" and you'll see the array of all the images in that book, and then you can copy and save them. If you know any regular expressions, you could also write a script that took any "Look Inside" web page and examined the code, got all the lookinside links, and then dumped them into whatever folder.

I'm not sure why Safari/IE don't show the image in the printed version... perhaps they don't enable JavaScript.. but then again they do another another trick to make it display if JavaScript is turned off.. I didn't look to closely at that. Anyways, for now that's all I got.
     
Chris O'Brien
Grizzled Veteran
Join Date: Nov 2003
Location: Hebburn, UK
Status: Offline
Reply With Quote
Dec 11, 2004, 12:24 PM
 
Originally posted by Synotic:
The "easiest" way I can think of capturing the image(s) write now is opening up the code and doing a search for "lookinside" and you'll see the array of all the images in that book, and then you can copy and save them. If you know any regular expressions, you could also write a script that took any "Look Inside" web page and examined the code, got all the lookinside links, and then dumped them into whatever folder.
You could just type this into the location bar (take the space out of java script):

javascript: for (var i=0; i < si_imageMetadata.length; i++) {var win = window.open('','', ''); win.document.write('<img src="' + si_imageMetadata[i].src + '">');}

It's a far from perfect solution, and'll popup about 20 windows, but you'll be ale to do what you want with the images.


Originally posted by Synotic:
I'm not sure why Safari/IE don't show the image in the printed version... perhaps they don't enable JavaScript.. but then again they do another another trick to make it display if JavaScript is turned off.. I didn't look to closely at that. Anyways, for now that's all I got.
I haven't looked much at it, but maybe they're using a different stylesheet for printing? That's how I'd do it.

Infact, the way Amazon has done this is pretty pants.

Anyone else notice the funny side of showing a book about CSS on a page that is so badly designed? Tables for layout? Please... This isn't 1997.
Just who are Britain? What do they? Who is them? And why?

Formerly Black Book
     
Love Calm Quiet  (op)
Mac Elite
Join Date: Mar 2001
Location: CO
Status: Offline
Reply With Quote
Dec 11, 2004, 12:59 PM
 
Thanks for the insights - not being much of a programmer (or doing much dynamic page stuff), I've avoided learning javascript, or this probably would have been obvious to me.

Well, it's interesting to me how js can be used to ~protect~ one's images (at least making it quite a hassle to get them off a web page).

I'm wondering: would you guess their approach was just the easiest for them to implement - or is it a going-out-of-their-way to please the copyright holders? [certainly seems the latter if they have a style sheet for "printing" that suppresses images]
TOMBSTONE: "He's trashed his last preferences"
     
Synotic
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Dec 11, 2004, 02:17 PM
 
Originally posted by Black Book:
You could just type this into the location bar (take the space out of java script):

javascript: for (var i=0; i < si_imageMetadata.length; i++) {var win = window.open('','', ''); win.document.write('<img src="' + si_imageMetadata[i].src + '">');}

It's a far from perfect solution, and'll popup about 20 windows, but you'll be ale to do what you want with the images.
That's pretty cool

I haven't looked much at it, but maybe they're using a different stylesheet for printing? That's how I'd do it.
I didn't think about that, but looking at the code, it looks like that's exactly what they did:

Code:
<style type="text/css" media="print"> <!-- .readerImage { background-image:none; display:none; } --> </style>
Originally posted by Love Calm Quiet:
Thanks for the insights - not being much of a programmer (or doing much dynamic page stuff), I've avoided learning javascript, or this probably would have been obvious to me.

Well, it's interesting to me how js can be used to ~protect~ one's images (at least making it quite a hassle to get them off a web page).

I'm wondering: would you guess their approach was just the easiest for them to implement - or is it a going-out-of-their-way to please the copyright holders? [certainly seems the latter if they have a style sheet for "printing" that suppresses images]
Easiest to implement as in the easiest way to get an image in there? The "easiest" option would be to simply put an image tag in there. I wouldn't really say it's "going out of their way" because protecting the images�however minimally�was probably part of the spec when they were writing the "Look inside the page" feature. I'm guessing it also protects the "Search inside the page" feature, which gives anyone access to the entire book. But yes, the reason they did it this way was to somewhat protect the copyright of the publishers. In fact, if you look right after the code I just posted above:

Code:
var copyright="Please respect the copyright of this material.";
Well that was an interesting investigation anyways
     
wataru
Addicted to MacNN
Join Date: Oct 2001
Location: Yokohama, Japan
Status: Offline
Reply With Quote
Dec 11, 2004, 10:42 PM
 
Firefox's contextual menu has a "show background image" option that will solve your problem.

Edit: Actually, it doesn't work in this case. Maybe because of the transparent image, or because it's a link. I'm not sure. But you can also get at the image with the "show page info" window, in the Media tab.
     
Alex Duffield
Grizzled Veteran
Join Date: Oct 2000
Location: Vancouver
Status: Offline
Reply With Quote
Dec 16, 2004, 03:54 PM
 
If you are using Safari, go to Window -> Activity

You will see all the images loaded up by that page...

the image you are after is there, just double click it and it will load up in the browser window... just drag it off or save it as normal.

http://lookinside2-images.amazon.com...WmJkXBKCmgDNxe
Alex Duffield
http://www.incontrolsolutions.com
Fatal error: Call to undefined function: signature() in /usr/local/www/htdocs/showthread.php on line 813
     
Love Calm Quiet  (op)
Mac Elite
Join Date: Mar 2001
Location: CO
Status: Offline
Reply With Quote
Dec 17, 2004, 02:34 PM
 
Thanks so much, Alex...
I had never even explored the "Activity" window in Safari.
Most helpful stuff!
TOMBSTONE: "He's trashed his last preferences"
     
kremmit
Junior Member
Join Date: Dec 2004
Status: Offline
Reply With Quote
Dec 18, 2004, 06:29 AM
 
java script: for (var i=0; i < si_imageMetadata.length; i++) {var win = window.open('','', ''); win.document.write('<img src="' + si_imageMetadata[i].src + '">');}


That is neat! Thanks!
     
Love Calm Quiet  (op)
Mac Elite
Join Date: Mar 2001
Location: CO
Status: Offline
Reply With Quote
Dec 18, 2004, 08:13 AM
 
Yes - v. cool, (naif that I am) I had never even heard rumor that a javascript command could be run by pasting into address bar. Might give me motivation finally to learn js!
TOMBSTONE: "He's trashed his last preferences"
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 03:52 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,