Forum Moderators: coopster

Message Too Old, No Replies

Need to display gallery of icons

         

Fryman

3:05 am on Feb 18, 2004 (gmt 0)

10+ Year Member



I am building a website, and I need to add some pages that will have several icons for download. How do I do it? Is there a script out there that can help me? It is a HTML site, so I could add some PHP pages that will have the icons, but I need a script to help me out.

As you may see... I am a total newbie :)

RonPK

9:11 am on Feb 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



An often used way to offer files for download is

<a href="icon.ext">download the icon</a>

Depending on many things, when a user clicks on the link either the icon will be shown or a download dialogue will appear.

If the icons are images in a common web format - .jpg, .gif or .png - you might try

<img src="icon.ext" alt="I'm an icon" width="16" height="16">

That will display the icon on the web page, and users can use standard browser functions to save the image on their hard disk.

No need for PHP, IMHO ;)

Fryman

7:03 pm on Feb 18, 2004 (gmt 0)

10+ Year Member



Thank you, Ron. The problem is that I have 1000 icons, so it would take me years to do it manually, that's why I was wondering if there was some script or something like that to show several galleries of icons.

RonPK

10:02 pm on Feb 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK, I get the point. How advanced does it have to be? Do you want to add descriptions (which may require some sort of database), or would it be enough to scan the image directory and display thumbnails? Should there be an upload facility? Have you searched on sites like hotscripts.com and scriptsearch.com? The script you need may already exist...

What exactly do you mean with 'icons'? Religious ones like in Russian Orthodox churches, or favicons in browsers' address bars?

Fryman

10:18 pm on Feb 18, 2004 (gmt 0)

10+ Year Member



Let me try to explain, I hope you understand, since I don't know much about scrips :)

I want to do a gallery with AIM Buddy Icons.

Lets say for example that my domain is www.example.com
My icons are in a folder called coolicons

One of the icons is called cooldog.gif.

The command to insert the icon to your AIM would be

aim:BuddyIcon?scr=http://www.example.com/coolicons/cooldog.gif.

So, when you click the cooldog.gif icon, it will be inserted as your new buddy icon.

What I want to know is if there is a script that can help me insert the command automatically into hundreds of icons, instead of having to link each one by hand.

I don't even know if I need a php script, or another kind.

RonPK

9:22 am on Feb 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Basically: read the contents of the image directory into an array, sort the array alphabetically, loop and print.

<?php 
$deDir = '/path/to/image/directory';
$d = @dir($deDir) or die("fatal error: directory '$deDir' does not exist");
while (false!== ($entry = $d->read())) {
$entries[] .= $entry;
}
$d->close();
sort($entries);
while (list(, $val) = each ($entries)) {
if (is_file($deDir . "/" . $val)) {
echo "<a href='aim:BuddyIcon?src=$val'><img src='$val'></a><br>\n";
}
}
?>