forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: Miscellaneous => Topic started by: copperminepro on January 22, 2008, 07:39:57 am

Title: Permanent image links in albums
Post by: copperminepro on January 22, 2008, 07:39:57 am
I can not create a topic in the Mods forum, if one of the moderators doesn't mind, could you split this topic and move it there? Maybe some other people could contribute.

This is for people who would like their thumbnail pages to have a permalink.

It will make your images have permanent links shown when you are browsing albums (ex. http://coppermine-gallery.net/demo/cpg14x/displayimage.php?pos=-372)

This is a great modification to make if you want search engine traffic. I have a site with 200k pageviews a day and only 2% of my traffic comes from image search. This modification should quadruple my gallery's search traffic in my niche.

The urls can be further SEO'd with rewrites. My images effectively appear as http://coppermine-gallery.net/demo/cpg14x/displayimage-372.html.


Open /includes/themes.inc.php (or your theme.php)

Find:
Code: [Select]
} else {
                $params = array('{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}' => "displayimage.php?album=$aid$cat_link&pos={$thumb['pos']}$uid_link",
                    '{THUMB}' => $thumb['image'],
                    '{CAPTION}' => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu']
                    );

Replace with:
Code: [Select]
} else {
                $params = array('{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}' => "displayimage.php?pos=-{$thumb['pid']}",
                    '{THUMB}' => $thumb['image'],
                    '{CAPTION}' => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu']
                    );

That's it...


There is an issue I have not solved yet... The film strip will NOT have the new friendly URL's, and the Next/Previous tabs will not have the new friendly permalinks.

I am working on these and will post when I have them working... I was told that this required extensive modification but making permalinks really is not much of a modification ??
Title: Re: Permanent image links in albums
Post by: SaWey on January 22, 2008, 07:44:09 am
Splitt and moved as suggested
Title: Re: Permanent image links in albums
Post by: copperminepro on January 22, 2008, 08:04:11 am
For the film strip pictures to have permanent links:

Open include/functions.inc.php

Find:

Code: [Select]
$p=$i - 1 + $lower_limit;
                        $p=($p < 0 ? 0 : $p);
                        $thumb_list[$i]['pos'] = $key < 0 ? $key : $p;
                        $thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"$pic_title\" />";
                        $thumb_list[$i]['caption'] = $CONFIG['display_film_strip_filename'] ? '<span class="thumb_filename">'.$row['filename'].'</span>' : '';
                        $thumb_list[$i]['admin_menu'] = '';

Replace With:
Code: [Select]
                       
$p=$i - 1 + $lower_limit;
                        $p=($p < 0 ? 0 : $p);
                        $thumb_list[$i]['pos'] = $key < 0 ? $key : $p;
$thumb_list[$i]['pid'] = $row['pid'];
                        $thumb_list[$i]['image'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"$pic_title\" />";
                        $thumb_list[$i]['caption'] = $CONFIG['display_film_strip_filename'] ? '<span class="thumb_filename">'.$row['filename'].'</span>' : '';
                        $thumb_list[$i]['admin_menu'] = '';




Open /include/themes.inc.php

Find:
   
Code: [Select]
    $i = 0;
    $thumb_strip = '';
    foreach($thumb_list as $thumb) {
        $i++;
        if ($mode == 'thumb') {
            $params = array('{CELL_WIDTH}' => $cell_width,
                '{LINK_TGT}' => "displayimage.php?album=$aid$cat_link&amp;pos={$thumb['pos']}$uid_link",
                '{THUMB}' => $thumb['image'],
                '{CAPTION}' => $thumb['caption'],
                '{ADMIN_MENU}' => ''
                );

Replace With:
Code: [Select]
    $i = 0;
    $thumb_strip = '';
    foreach($thumb_list as $thumb) {
        $i++;
        if ($mode == 'thumb') {
            $params = array('{CELL_WIDTH}' => $cell_width,
                '{LINK_TGT}' => "displayimage.php?pos=-{$thumb['pid']}",
                '{THUMB}' => $thumb['image'],
                '{CAPTION}' => $thumb['caption'],
                '{ADMIN_MENU}' => ''
                );
Title: Re: Permanent image links in albums
Post by: Kapsel on May 20, 2008, 04:14:03 pm
Genius script! :)
I had a problem with not-pemanent links in google and I couldn't find good solution. Now everything works great  ;D Thanks!
Title: Re: Permanent image links in albums
Post by: olti on June 12, 2008, 01:26:33 am
I use for my gallery Search Engine Friendly URLs plugin made by CPG team, so do I really need this hack?

I tried it but with this changes doesn't work anymore HighSlide plugin!!
Title: Re: Permanent image links in albums
Post by: olti on June 12, 2008, 11:46:07 pm
I use for my gallery Search Engine Friendly URLs plugin made by CPG team, so do I really need this hack?

?

Thank you.
Title: Re: Permanent image links in albums
Post by: Joachim Müller on June 13, 2008, 08:17:41 am
This is not a hotline. Respect board rules! >:( You already have a very negative karma record on this board. If you don't play by the rules, you'll get banned. This is the last warning!
Title: Re: Permanent image links in albums
Post by: net on July 09, 2008, 02:01:10 pm
You sir, is a hero!

I've been looking for this forever, thank you soo much, this makes everything so much better for users who wish to link images from the gallery, no one ever uses the url in the file information section.

Thanks!!
Title: Re: Permanent image links in albums
Post by: rony446 on July 29, 2008, 06:17:38 am
any one can tell me how can i put image caption upper of the image. normally image caption store in the below of the image. i want to put it upper of the image. can any body solve this plz..
Title: Re: Permanent image links in albums
Post by: Joachim Müller on July 29, 2008, 07:25:17 am
You already have an open thread (http://forum.coppermine-gallery.net/index.php/topic,54017.0.html) about that. Stop double and triple-posting.
Title: Re: Permanent image links in albums
Post by: copperminepro on August 06, 2008, 02:20:32 pm
I use for my gallery Search Engine Friendly URLs plugin made by CPG team, so do I really need this hack?

I tried it but with this changes doesn't work anymore HighSlide plugin!!

Yes, it's pretty important for SEO
Title: Re: Permanent image links in albums
Post by: Joachim Müller on August 06, 2008, 08:59:58 pm
The SEF_URLs plugin has been abandoned by the coppermine devs, since it was just too buggy. You're welcome to continue the development of the SEF_URLs plugin.
Title: Re: Permanent image links in albums
Post by: mahdi1234 on December 12, 2008, 11:05:23 am
There is an issue I have not solved yet... and the Next/Previous tabs will not have the new friendly permalinks.

I am working on these and will post when I have them working... I was told that this required extensive modification but making permalinks really is not much of a modification ??

Hi copperminepro - did you get anywhere with the Next/Previous links?
Title: Re: Permanent image links in albums
Post by: Killswitch on December 14, 2008, 08:16:52 am
Sweet, I was just about to work on this when I read about the pos causing results to fluctuate.  Saved me alot of hassle :D
Title: Re: Permanent image links in albums
Post by: kylemj on August 17, 2010, 03:40:10 pm
just what i'm after, going to install when got some time :)