Insert a list of your running auctions, with photos, into your auction descriptions.
One of the ways to advertise your other auctions in any given auction description is to use a gallery ? a scrolling viewport with thumbnail photos of all your running auctions ? as described in [Hack #47]. Aside from the commercial versions, there's a way to create a custom gallery using the eBay API.
First, include this code in your description:
<iframe src="http://www.ebayhacks.com/cgi-bin/gallery.pl" style="width:100%;margin:0;border:0;">
The URL referenced in this iframe (see [Hack #51]) should point to your own server and cgi-bin directory. See the Using CGI Scripts sidebar if you're not sure how to do this.
Using CGI Scripts
Every web server has a dedicated folder (directory) in which scripts or programs are placed. Instead of displaying the contents of the scripts, as would happen with ordinary HTML files, the web server software runs the scripts and displays their output instead. This special script directory is typically called cgi-bin, wherein CGI stands for "common gateway interface." Refer to your web server software's documentation for details on setting up a cgi-bin directory, or contact your administrator (ISP) if you're renting space on someone else's web server.
Now, copying the Perl scripts discussed throughout this book into your cgi-bin directory is easy enough; the hard part can be making them work.
Provided that the scripts are in the correct location, all you need to do on Unix systems is to make them executable, like this:
chmod +x gallery.pl
where gallery.pl is the filename of the script.
On Windows systems, each Perl script must have a filename that ends with .pl. Then, you'll need to associate the .pl filename extension with your Perl interpreter. In most cases, this will be done for you when you install Perl.
The last step is to reference the script with the proper URL, like this:
where www.ebayhacks.com is the address of your server, cgi-bin is the public name of your cgi-bin directory (not always the same as the private name), and gallery.pl is the filename of your script. If all goes well, you should see the output of the script in your web browser. (It's important to note that not all Perl scripts in this book are CGI scripts.)
If you get an error when you try to run the script from your browser, try running it from the command line instead to see more-detailed error messages.
Here's the script that generates a simple gallery:
Note that only auctions for which you've added the Gallery listing upgrade and specified a gallery image (as described in [Hack #36]) will appear, as shown in Figure 8-1.
If you're not using the Gallery upgrade, you can specify your own images. Simply replace line  with this:
$gallery = "http://www.ebayhacks.com/images/$id.jpg";
where http://www.ebayhacks.com is the address of your server and /images is the directory containing your personal gallery images (in JPG format). Name the images after your auction numbers (e.g., 4500205199.jpg), and you're good to go!
This gallery script will be run and the GetSellerList API call will be used every time the auction page is loaded, which is probably much more often than necessary. This is an example of when it makes sense to [Hack #99].