links in photo descriptions?

gabstero
gabstero's picture

Joined: 2010-01-06
Posts: 51
Posted: Fri, 2012-05-18 17:40

Hi Gang!

Quick one. What should I do to be able to automatically have anything starting with "http://..." become a live link in the photo descriptions (and album description)?

many thanks!
Gabster

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 26107
Posted: Fri, 2012-05-18 18:02

http://codex.gallery2.org/Gallery3:Modules:purifier

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
gabstero
gabstero's picture

Joined: 2010-01-06
Posts: 51
Posted: Fri, 2012-05-18 18:31

thanks Dave - uploaded the module to my gallery module folder, but I cannot see it listed in the admin/modules. Do you know what might be wrong? It's located in:

modules/purifier

thanks,
gab

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 669
Posted: Fri, 2012-05-18 18:43

It should be listed as 'HTML Purifer" If it's not listed check to ensure you didn't accidentally unzip it within the purifier director... (wrong = modules/purifier/purifier) If you're good there, and it still doesn't show, check that the directory is read/write/execute by the user the web server runs as.

 
gabstero
gabstero's picture

Joined: 2010-01-06
Posts: 51
Posted: Fri, 2012-05-18 18:53

thanks -

of course I unzipped it in the /var/modules folder. Copied them in the right folder and pronto they show up in my module!

But - how do I configure the purifier?

thanks,
g

 
gabstero
gabstero's picture

Joined: 2010-01-06
Posts: 51
Posted: Fri, 2012-05-18 19:15

Ok - with the purifier installed - my links in the description aren't live: http://www.mamaliga.com/gallery3/index.php/BBA/bread

am i doing something wrong?

thanks!
g

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 26107
Posted: Fri, 2012-05-18 21:10

New links?
or are you doing html like:
<a href="http://example.com">link test</a>

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 7939
Posted: Sat, 2012-05-19 03:06

Without adding the weight of a full module, you can add thie javascript to your page.html.php:

<script type="text/javascript">
  $(document).ready(function() {
    var h = $('ul.g-metadata>li:contains("Description:")').html();
    if(h) $('ul.g-metadata>li:contains("Description:")').html(h.replace(/((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi, '<a href="$1" target="_blank">$1</a>'));
  });
</script>

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
gabstero
gabstero's picture

Joined: 2010-01-06
Posts: 51
Posted: Tue, 2012-05-22 15:26

Dave: tried with the <a href... etc. It works like that but not without it.

suprsidr - added the script in the head section of the page.html.php - no work :-(

thanks for the help!
g

 
gabstero
gabstero's picture

Joined: 2010-01-06
Posts: 51
Posted: Tue, 2012-05-22 15:31

suprsidr - I take that back. It works in the description located on the right of the picture, but not the one underneath the pic. You know which page should I tweak for that to change?

thanks!
Gabstero

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 26107
Posted: Tue, 2012-05-22 15:54
Quote:
It works like that but not without it.

That would be expected as it is HTML.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 7939
Posted: Tue, 2012-05-22 15:59
Quote:
It works in the description located on the right of the picture, but not the one underneath the pic

you have to perform the operation on that element too:

<script type="text/javascript">
  $(document).ready(function() {
    var h = $('ul.g-metadata>li:contains("Description:")').html();
    if(h){
         $('ul.g-metadata>li:contains("Description:")').html(h.replace(/((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi, '<a href="$1" target="_blank">$1</a>'));
        $('#g-info').html(h);
    }
  });
</script>

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
gabstero
gabstero's picture

Joined: 2010-01-06
Posts: 51
Posted: Tue, 2012-05-22 16:08

thanks Dave - but I thought the purifier would do that.

suprsidr - it worked but the link has a "</div>" after it for some reason. See here: http://www.mamaliga.com/gallery3/index.php/BBA/bread

thanks!

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 7939
Posted: Tue, 2012-05-22 16:22

you need a space after your link

But it looks like you are using purifier, so you don't need the javascript.(you'll get double links)

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
gabstero
gabstero's picture

Joined: 2010-01-06
Posts: 51
Posted: Tue, 2012-05-22 16:30

the trouble is that purifier doesn't do anything to my links :-(

g

 
gabstero
gabstero's picture

Joined: 2010-01-06
Posts: 51
Posted: Tue, 2012-05-22 16:33

and the space didn't help either... The purifier is currently disabled - still getting double links though.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 7939
Posted: Tue, 2012-05-22 16:35

purifier allows you to use html, so format your links like:
<a href="http://www.actual-link.com" target="_blank">Link text</a>
to help you can use the wysiwyg editor.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
gabstero
gabstero's picture

Joined: 2010-01-06
Posts: 51
Posted: Tue, 2012-05-22 16:37

that's fine - thanks... I just thought you could do the same thing as you can in photo description on flickr.

g.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 7939
Posted: Tue, 2012-05-22 16:38

I updated the above javascript, I was being lazy earlier and just copied/pasted fixed now.

Quote:
and the space didn't help either

I ran into this myself(long time ago), maybe you needed a carriage return instead - don't remember.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2