Applying Special Picture Effects


The previous seven templates use relatively simple picture effectsthat is, all you have to do is dictate where on the page the photo will display, and that's what you get. That's well and good, but there are some fancier photo effects you can employ in your listings, which we'll examine next.

Template 7.8. Link to a Larger Picture

Some potential buyers are on high-speed broadband connections, and have no problems downloading large, high-resolution images. Other potential buyers are on slow dial-up connections that take forever to download large images. This is why, in general, you want to include only smaller images in your listings, so that your page loads acceptably for all potential buyers.

That doesn't mean, however, that having larger, higher-resolution photos available isn't a good idea. You just don't want to burden all potential buyers with those slow-to-download image files that require a higher-resolution desktop to display properly. To that end, you can choose to display a standard low-resolution photo in the listing itself, as shown in Figure 7.8, but then link to a higher-resolution photo, hosted on another website. When potential bidders click on the low-res photo, the high-res photo is displayed.

Figure 7.8. A small, low-resolution photo displayed in the body of the listing; click on the photo and a larger, higher-resolution photo is displayed.


This technique requires you to upload two different photos to your picture hosting service. In the following code, URL-BIG is the larger, higher-resolution photo, while URL-SMALL is the smaller, lower-resolution photo. The code is simple; all you do is add a link around the low-res photo to the high-res one.

<h1 style="text-align: center">This is the title</h1> <center> <a href="URL1"><img src="URL2"><BR> Click for larger photo</a> </center> <p style="text-align: left"> This is the first paragraph of the description </p> <p style="text-align: left"> This is the second paragraph of the description </p>


Note that we also added a "click for larger photo" text instruction under the photo. Clicking either the photo or the text will display the larger photo.

Template 7.9. Big Picture with Multiple Click-to-Display Buttons

Now we'll get really fancy. The template shown in Figure 7.9 displays a single large picture, with a row of buttons underneath. When a visitor clicks a button, the picture changes. It's a great way to display multiple photos in the limited space of an eBay item listing.

Figure 7.9. Displaying a single large picture with multiple click-to-display buttons.


The code for this trick is a trifle complex, so pay close attention. As written, the code creates eight buttons (for eight photos), but if you don't have that many you can cut the excess lines of code.

Note

In several of the following examples, you'll note lines of code that begin with an exclamation point following a left-bracket, like this: <!. This exclamation point code indicates a comment linethat is, a line that is not read as code, but is instead used to insert comments to anyone reading or editing the code.


Start by putting the following code at the very beginning of your listing:

<!--BEGINNING OF FIRST CODE BLOCK--> <!--INSERT AT THE VERY BEGINNING OF THE BODY SECTION--> <script language="JavaScript"> var CachedImages CachedImages = new Array(8) CachedImages[0] = new Image CachedImages[0]="URL1" CachedImages[1] = new Image CachedImages[1]="URL2" CachedImages[2] = new Image CachedImages[2]="URL3" CachedImages[3] = new Image CachedImages[3]="URL4" CachedImages[4] = new Image CachedImages[4]="URL5" CachedImages[5] = new Image CachedImages[5]="URL6" CachedImages[6] = new Image CachedImages[6]="URL7" CachedImages[7] = new Image CachedImages[7]="URL8" function ChangeImage(n) { document.SpaceImage.src=CachedImages[n] } </script> <!--END OF FIRST CODE BLOCK--> Then use the following template code: <!--REGULAR TEMPLATE CODE--> <h1 style="text-align: center">This is the title</h1> <p style="text-align: left"> This is the first paragraph of the description </p> <p style="text-align: left"> This is the second paragraph of the description </p> <!--END OF REGULAR TEMPLATE CODE--> <!--BEGINNING OF SECOND CODE BLOCK--> <!--INSERT WHERE YOU WANT THE PHOTOS TO APPEAR--> <center> <img src="URL1" name="SpaceImage" height="400"> </center> <p> <form name="ImageSelector"> <center> <input type="button" value="Picture 1" onClick="ChangeImage(0)"> <input type="button" value="Picture 2" onClick="ChangeImage(1)"> <input type="button" value="Picture 3" onClick="ChangeImage(2)"> <input type="button" value="Picture 4" onClick="ChangeImage(3)"><br> <input type="button" value="Picture 5" onClick="ChangeImage(4)"> <input type="button" value="Picture 6" onClick="ChangeImage(5)"> <input type="button" value="Picture 7" onClick="ChangeImage(6)"> <input type="button" value="Picture 8" onClick="ChangeImage(7)"> </center> </form> </p> <!--END OF SECOND CODE BLOCK-->


Note

If you try to test this code with pictures stored locally on your hard disk, it won't work. This code works only with pictures actually uploaded to a web server.


Whewthat's a lot of code! If you choose to adapt this code for use in other templates, know that there are two separate code blocks you have to deal with. The first code block should go at the very beginning of the <body> sectionthat is, it should be the initial code in your template. The second code block should be placed wherever you want the photos to display in your listing.

Template 7.10. Big Picture with Click-to-Enlarge Thumbnails

This next trick creates a similar picture effect, this time with thumbnails of the additional pictures below the main picture. As you can see in Figure 7.10, when the potential buyer clicks a thumbnail, the big picture changes to display the new picture.

Figure 7.10. A large master picture with multiple click-to-enlarge thumbnails.


This code requires you to create both large and small (thumbnail) versions of each of your photos. (The small versions of your pictures should be no more than 100 pixels wide.) The thumbnails are displayed in the picture grid; the large versions are displayed when you click the thumbnails.

<!--REGULAR TEMPLATE CODE--> <h1 style="text-align: center">This is the title</h1> <p style="text-align: left"> This is the first paragraph of the description </p> <p style="text-align: left"> This is the second paragraph of the description </p> <!--END OF REGULAR TEMPLATE CODE--> <!--BEGINNING OF PICTURE CODE--> <table align="center" cellspacing="20" height="500"> <tr> <td> <center> <img src="URL1-BIG" height="400" border="0" alt name="the_pic"><br><br> <a href="#"; onClick="document.the_pic.src='URL1-BIG'; return false;">    <img src="URL1-SMALL" border="0"></a> <a href="#"; onClick="document.the_pic.src='URL2-BIG'; return false;">    <img src="URL2-SMALL" border="0"></a> <a href="#"; onClick="document.the_pic.src='URL3-BIG'; return false;">    <img src="URL3-SMALL" border="0"></a> <a href="#"; onClick="document.the_pic.src='URL4-BIG'; return false;">    <img src="URL4-SMALL" border="0"></a> <a href="#"; onClick="document.the_pic.src='URL5-BIG'; return false;">    <img src="URL5-SMALL" border="0"></a> <a href="#"; onClick="document.the_pic.src='URL6-BIG'; return false;">    <img src="URL6-SMALL" border="0"></a> </center> <p style="text-align: center; font-family: Arial; font-weight: bold; font-size: 12pt"> Click on thumbnails to enlarge</p> </td> </tr> </table> <!--END OF PICTURE CODE-->


The picture code should be inserted wherever in your template you want to display the picture grid. Replace URL1-BIG, URL2-BIG, and so on with the URLs for your large pictures; replace URL1-SMALL, URL2-SMALL, and so on with the URLs for your thumbnail pictures.

Template 7.11. Scrolling Picture Slideshow

This template features a scrolling slideshow of pictures, as shown in Figure 7.11. All the pictures for your listing will scroll by in a repeating loopanother good way to display multiple photos in a limited space.

Figure 7.11. A scrolling picture slideshow.


To create this complex slideshow, we need to use some complex JavaScript code. This example allows for four photos; you can use more photos by adding extra slideimages lines, with consecutive numbering. Replace URL1, URL2, and so on with the URLs of your picture files. Make sure you place the slideshow code in your template where you want the slideshow to display.

[View full width]

<!--REGULAR TEMPLATE CODE--> <h1 style="text-align: center">This is the title</h1> <p style="text-align: left"> This is the first paragraph of the description </p> <p style="text-align: left"> This is the second paragraph of the description </p> <!--END OF REGULAR TEMPLATE CODE--> <!--BEGINNING OF SLIDESHOW CODE--> <script language="JavaScript1.2"> var scrollerwidth='400px' var scrollerheight='400px' var scrollerbgcolor='white' var pausebetweenimages=3000 var slideimages=new Array() slideimages[0]='<img src="URL1" border=0" height="400" width="400">' slideimages[1]='<img src="URL2" border=0" height="400" width="400">' slideimages[2]='<img src="URL3" border=0" height="400" width="400">' slideimages[3]='<img src="URL4" border=0" height="400" width="400">' var ie=document.all var dom=document.getElementById if (slideimages.length>1) i=2 else i=0 function move1(whichlayer){ tlayer=eval(whichlayer) if (tlayer.left>0&&tlayer.left<=5){ tlayer.left=0 setTimeout("move1(tlayer)",pausebetweenimages) setTimeout("move2(document.main.document.second)", pausebetweenimages) return } if (tlayer.left>=tlayer.document.width*-1){ tlayer.left-=5 setTimeout("move1(tlayer)",50) } else{ tlayer.left=parseInt(scrollerwidth)+5 tlayer.document.write(slideimages[i]) tlayer.document.close() if (i==slideimages.length-1) i=0 else i++ } } function move2(whichlayer){ tlayer2=eval(whichlayer) if (tlayer2.left>0&&tlayer2.left<=5){ tlayer2.left=0 setTimeout("move2(tlayer2)",pausebetweenimages) setTimeout("move1(document.main.document.first)", pausebetweenimages) return } if (tlayer2.left>=tlayer2.document.width*-1){ tlayer2.left-=5 setTimeout("move2(tlayer2)",50) } else{ tlayer2.left=parseInt(scrollerwidth)+5 tlayer2.document.write(slideimages[i]) tlayer2.document.close() if (i==slideimages.length-1) i=0 else i++ } } function move3(whichdiv){ tdiv=eval(whichdiv) if (parseInt(tdiv.style.left)>0&&parseInt(tdiv.style.left) <=5){ tdiv.style.left=0+"px" setTimeout("move3(tdiv)",pausebetweenimages) setTimeout("move4(scrollerdiv2)",pausebetweenimages) return } if (parseInt(tdiv.style.left)>=tdiv.offsetWidth*-1){ tdiv.style.left=parseInt(tdiv.style.left)-5+"px" setTimeout("move3(tdiv)",50) } else{ tdiv.style.left=scrollerwidth tdiv.innerHTML=slideimages[i] if (i==slideimages.length-1) i=0 else i++ } } function move4(whichdiv){ tdiv2=eval(whichdiv) if (parseInt(tdiv2.style.left)>0&&parseInt(tdiv2.style.left) <=5){ tdiv2.style.left=0+"px" setTimeout("move4(tdiv2)",pausebetweenimages) setTimeout("move3(scrollerdiv1)",pausebetweenimages) return } if (parseInt(tdiv2.style.left)>=tdiv2.offsetWidth*-1){ tdiv2.style.left=parseInt(tdiv2.style.left)-5+"px" setTimeout("move4(scrollerdiv2)",50) } else{ tdiv2.style.left=scrollerwidth tdiv2.innerHTML=slideimages[i] if (i==slideimages.length-1) i=0 else i++ } } function startscroll(){ if(ie||dom){ scrollerdiv1=ie? first2 : document.getElementById("first2") scrollerdiv2=ie? second2 : document.getElementById ("second2") move3(scrollerdiv1) scrollerdiv2.style.left=scrollerwidth } else if (document.layers){ document.main.visibility='show' move1(document.main.document.first) document.main.document.second.left=parseInt(scrollerwidth)+5 document.main.document.second.visibility='show' } } window.onload=startscroll </script> <div align="center"> <script language="JavaScript1.2"> if(ie||dom){ document.writeln('<div style="position:relative;width:'+scrollerwidth+'; height :'+scrollerheight+';overflow:hidden; background-color:'+scrollerbgcolor+'">') document.writeln('<div style="position:absolute;width:'+scrollerwidth+'; height: '+scrollerheight+';clip:rect (0 '+scrollerwidth+' '+scrollerheight+' 0); left:0px;top:0px">') document.writeln('<div style="position:absolute;width:'+scrollerwidth+'; left: 1px;top:0px;">') document.write(slideimages[0]) document.writeln('</div>') document.writeln('<div style="position:absolute;width:'+scrollerwidth+'; left :0px;top:0px">') document.write(slideimages[1]) document.writeln('</div>') document.writeln('</div>') document.writeln('</div>') } </script> </div> <!--END OF SLIDESHOW CODE-->


Template 7.12. Animated Picture Flipshow

Another approach to the picture slideshow is the animated flipshow, as shown in Figure 7.12. With this type of slideshow, the pictures don't scroll, they flip from one to another.

Figure 7.12. An animated flip-type picture slideshow.


This is another JavaScript template. This particular code allows for four pictures (variableslide 0 through 3). To use more pictures, add additional variableslide lines (numbering upward from 4); to use fewer pictures, delete one or more variableslide lines starting from the last one backward. Again, you insert the slideshow code in your auction template where you want the slideshow to appear. And make sure that your pictures are sized to the 400 x 400 size specified in the code, or they'll be stretched or squeezed to fit. (Alternately, you can change the 400 x 400 specification to match the size of your particular photos.)

[View full width]

<!--REGULAR TEMPLATE CODE--> <h1 style="text-align: center">This is the title</h1> <p style="text-align: left"> This is the first paragraph of the description </p> <p style="text-align: left"> This is the second paragraph of the description </p> <!--END OF REGULAR TEMPLATE CODE--> <!--BEGINNING OF SLIDESHOW CODE--> <div align=center> <script language="JavaScript1.2"> var variableslide=new Array() variableslide[0]=['URL1','',''] variableslide[1]=['URL2','',''] variableslide[2]=['URL3','',''] variableslide[3]=['URL4','',''] var slidewidth='400px' //set to width of LARGEST image var slideheight='400px' //set to height of LARGEST image var slidebgcolor='gray' var slidedelay=3000 var ie=document.all var dom=document.getElementById for (i=0;i<variableslide.length;i++){ var cacheimage=new Image() cacheimage.src=variableslide[i][0] } var currentslide=0 function rotateimages(){ contentcontainer='<center>' if (variableslide[currentslide][1]!="") contentcontainer+='<a href="'+variableslide [currentslide][1]+'">' contentcontainer+='<img src="/books/2/949/1/html/2/'+variableslide [currentslide][0]+'" border="0" vspace="3">' if (variableslide[currentslide][1]!="") contentcontainer+='</a>' contentcontainer+='</center>' if (variableslide[currentslide][2]!="") contentcontainer+=variableslide[currentslide][2] if (document.layers){ crossrotateobj.document.write(contentcontainer) crossrotateobj.document.close() } else if(ie||dom) crossrotateobj.innerHTML=contentcontainer if (currentslide==variableslide.length-1) currentslide=0 else currentslide++ setTimeout("rotateimages()",slidedelay) } if(ie||dom) document.write('<div style="width:'+slidewidth+';height:'+slideheight+'; background-color:'+slidebgcolor+"'></div>') function start_slider(){ crossrotateobj=dom? document.getElementById ("slidedom") : ie? document.all.slidedom : document.slidensmain.document.slidenssub if (document.layers) document.slidensmain.visibility="show" rotateimages() } if(ie||dom) start_slider() else if (document.layers) window.onload=start_slider </script> </div> <!--END OF SLIDESHOW CODE-->


Template 7.13. Manual Advance Picture Slideshow

This next template presents yet another type of slideshow. This manual advance slideshow is nifty because it includes both automatic play (via the Start button) and manual advance, via backward/foreword buttons. As you can see in Figure 7.13, visitors can even use the pull-down list to go directly to a particular photo. It's the ultimate in shopper convenience!

Figure 7.13. Multiple photos displayed in manual advance slideshow.


Like most of these slideshows, this template uses some complicated JavaScript code. This particular example is coded for four photos, but you can add more by including additional <option> statements, increasing the numbering in order. Or, if you have fewer photos, just delete the last <option> line(s). Of course, you should replace URL1, URL2, and so forth with the URLs for your image files. And, as with the previous template, make sure that your photos don't exceed the 400 x 400 size.

[View full width]

<!--REGULAR TEMPLATE CODE--> <h1 style="text-align: center">This is the title</h1> <p style="text-align: left"> This is the first paragraph of the description </p> <p style="text-align: left"> This is the second paragraph of the description </p> <!--END OF REGULAR TEMPLATE CODE--> <!--BEGINNING OF SLIDESHOW CODE--> <script language="JavaScript"> <!--start var x = 0; function rotate(num){ x=num%document.slideForm.slide.length; if(x<0){x=document.slideForm.slide.length-1}; document.images.show.src= document.slideForm.slide.options[x].value; document.slideForm.slide.selectedIndex=x; } function apRotate() { if(document.slideForm.slidebutton.value == "Stop"){ rotate(++x);window.setTimeout("apRotate()", 5000);} } //end --> </script> <form name="slideForm"> <table cellspacing=1 cellpadding=4 style="border:1px black solid; border-collapse: collapse" align="center"> <tr><td align="center"> <strong><font face="Arial" size="3"> Product Photos</font></strong> </td></tr> <tr><td align=center width=400 height=400> <img src="/books/2/949/1/html/2/URL1" name="show"> </td></tr> <tr><td align=center style="border:1px black solid;"> <select name="slide" onChange="rotate(this.selectedIndex);"> <option value="URL1" selected>Photo 1 <option value="URL2">Photo 2 <option value="URL3">Photo 3 <option value="URL4">Photo 4 </select> </td></tr> <tr><td align=center style="border:1px black solid;"> <input type=button onclick="rotate(0);" value="ll&lt;&lt;" title="Jump to beginning" style="border:1px black solid;"> <input type=button onclick="rotate(x-1);" value="&lt;&lt;" title="Last Picture" style="border:1px black solid;"> <input type=button name="slidebutton" onClick="this.value=((this.value=='Stop') ?'Start': 'Stop');apRotate();" value="Start" title="Autoplay" style="width:75px; border:1px black solid;"> <input type=button onclick="rotate(x+1);" value="&gt;&gt;" title="Next Picture" style="border:1px black solid;"> <input type=button onclick="rotate(this.form.slide.length-1);" value="&gt;&gt;ll" title="Jump to end" style="border:1px black solid;"> </td></tr> </table> </form> <!--END OF SLIDESHOW CODE-->





eBay Auction Templates Starter Kit
eBay Auction Templates Starter Kit
ISBN: 0789735636
EAN: 2147483647
Year: 2007
Pages: 101

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net