Inserting favicon

apox

Joined: 2003-11-10
Posts: 4
Posted: Tue, 2003-11-11 04:05

Hello,

How would I go about adding a favicon to my gallery? I have a favicon made and ready at [snip].

 
joan
joan's picture

Joined: 2002-10-21
Posts: 3473
Posted: Tue, 2003-11-11 09:37

Put it in your gallery directory and add <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> just below <head> in albums.php, view_album.php and view_photo.php

 
JaySaeger

Joined: 2003-11-27
Posts: 2
Posted: Thu, 2003-11-27 04:58

I found that the easiest way to have your favicon.ico displayed on EVERY gallery page is to edit the function "_getStyleSheetLink" in util.php.

Change these 3 lines:

        return '<link rel="stylesheet" type="text/css" href="' .
                $url .
                '">' ;

To these 5 lines:

        return '<link rel="stylesheet" type="text/css" href="' .
                $url .
                '">' .
                '<link rel="icon" href="/favicon.ico" type="image/x-icon">' .
                '<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">';

Obviously this is a quick and dirty hack, but this is currently the only function that gets called every time between the <head> output in *.php. A better solution would be to generalize the header output in another func.

Anyway, I'm sure a lot of people would appreciate having favicon support rolled into the official Gallery at some point.

Visit the Polaprints Gallery to see this hack in action...

 
jmccunep

Joined: 2003-10-29
Posts: 23
Posted: Wed, 2003-12-03 14:25
Quote:
I found that the easiest way to have your favicon.ico displayed on EVERY gallery page is to edit the function "_getStyleSheetLink" in util.php.

I tried this. Gallery wouldn't run after attempting it, gave a bunch of errors. Are you using this code as is and you're confident there are no typos in what you printed here?

 
JaySaeger

Joined: 2003-11-27
Posts: 2
Posted: Thu, 2003-12-04 00:44

No, no typo; this exactly what I'm using.

What was the error? Most likely when you copy/pasted, some extra space and/or newlines were added.

 
jmccunep

Joined: 2003-10-29
Posts: 23
Posted: Thu, 2003-12-04 01:33

Sorry I didn't copy down the errors. There were two lines of text describing the errors, with code line numbers etc, and none of the Gallery pages were viewable any longer until I put back the original copy of util.php

I don't know enough about web environments. Is href="/favicon.ico" equal to href="favicon.ico" ?

 
jmccunep

Joined: 2003-10-29
Posts: 23
Posted: Thu, 2003-12-04 01:53

Further question. What is the significance of whitespace and newlines you mention? The code you sent as 5 lines effectively could be one long line of code terminated by a semicolon, right? Is the code shown below equivalent to what you sent if not as readable?

return '<link rel="stylesheet" type="text/css" href="' . $url . '">' . '<link rel="icon" href="/favicon.ico" type="image/x-icon">' . '<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">';

How do you know if you've added new lines? If the editing is done in a text editor like Windows Notepad are you covered? Or would Dreamweaver MX be a better editing environment to help avoid this? Where would whitespace be a problem?

Thanks for your patient help!

 
JST

Joined: 2008-01-02
Posts: 6
Posted: Wed, 2008-01-02 18:06

Hello! I've been trying out for days on how t make this work with FF and Safari. I have uploaded a Favicon few days back but when I try to replace it, I still get the old one appearing. Plus, it only appears in the main page and not in the subalbums. I am using Exreme Theme. Thanks!

____________
http://www.josesantiagotan.com/
http://www.josesantiagotan.com/photos/
http://www.heddatan.com/

 
Manitou
Manitou's picture

Joined: 2008-03-26
Posts: 14
Posted: Tue, 2008-05-20 21:58

I do not know the Extreme Theme.
For the Ebony theme,
I put the favicon.ico in the themes/ebony/images/ directory
I put the code
<link rel="icon" href="themes/ebony/images/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="themes/ebony/images/favicon.ico" type="image/x-icon"> in the <head> of the theme.tpl, and it works fine, for all the albums and subalbums.

Hope it will help you.

 
stewlis

Joined: 2007-09-17
Posts: 4
Posted: Wed, 2008-07-30 01:20

I'm trying to accomplish the same thing (I'm using Gallery v2.2.5).

Where are albums.php, view_album.php and view_photo.php located?

 
stewlis

Joined: 2007-09-17
Posts: 4
Posted: Wed, 2008-07-30 01:24

D'OH! I just realized this was a G1 forum. I swear I clicked the G2 link....strange. But it does explain why I wasn't having any luck! :)

Sorry about that.

<A HREF="http://www.stewartlane.com/gallery">My Gallery</A>