Plugin for generating links to the current photo...

rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Fri, 2009-06-12 00:19

So I've been sitting here, playing around with Gallery 3, Beta 1 and I decided that I wanted to have the album and photo pages display html links that someone could copy and paste into other web sites, forums, etc to link to that page / photo. As I can't seem to find any existing modules to do this, I've hacked together some code from a couple of other modules to do what I want. It should be attached to this post, in case anyone else is looking to do something similar.

---
Report Problems/Suggestions Here | Get latest version | Documentation | Coffee Fund | My Library | My GitHub

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2009-06-12 03:16

Thanks for the contribution!
Since this is the real first 3rd party module for g3 that I have seen we need to do some documentation.
Care to start off with http://codex.gallery2.org/Gallery3:Modules:embedlinks and fill in some info? If you get stuck let me know and I will assist.

I will try to get some structure to the documentation as we only really have:
http://codex.gallery2.org/Gallery3:Modules at this time.

I will try your module later when I find some time as well. :-)

Cheers!
Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Fri, 2009-06-12 04:20
floridave wrote:
Thanks for the contribution!
Since this is the real first 3rd party module for g3 that I have seen we need to do some documentation.
Care to start off with http://codex.gallery2.org/Gallery3:Modules:embedlinks and fill in some info? If you get stuck let me know and I will assist.

Done, how's that look?

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Fri, 2009-06-12 08:39

Hey great! If you create a fork of gallery3-contrib on Github and then add this module there, I'll pull it into the contrib repo for you so that others can get to it easily.
---
Problems? Check gallery3/var/logs before you post! and file bugs here!
Latest zip: http://github.com/gallery/gallery3/zipball/master
Latest git: http://codex.gallery2.org/Gallery:Using_Git

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Mon, 2009-07-13 03:10

I found a flaw in my HTML code ("views/embedlinks_photo_block.html.php") that causes it to not work properly if there is a "'" in the URL. This version will fix it.

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Fri, 2009-06-12 20:09
bharat wrote:
Hey great! If you create a fork of gallery3-contrib on Github and then add this module there, I'll pull it into the contrib repo for you so that others can get to it easily.

Okay, I think I just did what you asked:
http://github.com/rWatcher/gallery3-contrib

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sat, 2009-06-13 01:21

Excellent. I've pulled your code into gallery3-contrib.. now if you commit your changes back to the fork I can pull it into gallery3-contrib whenever you tell me to. Thanks!

---
Problems? Check gallery3/var/logs before you post! and file bugs here!
Latest zip: http://github.com/gallery/gallery3/zipball/master
Latest git: http://codex.gallery2.org/Gallery:Using_Git

 
talmdal

Joined: 2006-12-06
Posts: 358
Posted: Sat, 2009-06-13 05:25

@rWatcher: way to go, the first module to be contributed by someone outside the team. Just wonder did you make use of the developer module to kick start the module creation. Any snags or bumps that don't make it a smooth process?

Tim
http://www.timalmdal.com

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Sat, 2009-06-13 05:51
talmdal wrote:
@rWatcher: way to go, the first module to be contributed by someone outside the team. Just wonder did you make use of the developer module to kick start the module creation.

No, I actually didn't realize that there was a developer module until after I had written mine. I'm definitely going to have to take a look at it when I get some free time though.

talmdal wrote:
Any snags or bumps that don't make it a smooth process?

Not really. I basically just dug around in the code for the other modules to figure out how everything worked. The only thing that wasn't completely smooth was I duplicated an existing module to use as a template and it took me a couple of tries to find/change all occurrences of the original module name. But otherwise everything seemed pretty straightforward, even without using the developer module.

 
lysp

Joined: 2006-03-16
Posts: 25
Posted: Sat, 2009-06-13 10:58

It's great to see how simple and easy the code for this is.

I remember looking at trying to modify 2 and gave up. This i can understand the lot.

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Sat, 2009-07-25 18:13

I've created an updated version of my embedlinks module. New in this version:
- Now includes BBCode in addition to HTML links.
- Now it will only display links to a fullsized version of a photo if the current visitor actually has the necessary privileges to view it.
- Added an admin page to switch displaying of HTML and BBCode on and off (so if you don't want either type you can disable it).
- Added code to display links in a dialog window (similar to how the exif plugin works).
- Added an admin page to switch between displaying link codes on the page (how the previous version worked) or in a dialog.

The new version is attached to this post and it can also be found on my github at http://github.com/rWatcher/gallery3-contrib/tree/master

 
talmdal

Joined: 2006-12-06
Posts: 358
Posted: Mon, 2009-07-13 05:07

Its merged into gallery/gallery3-contrib

http://www.timalmdal.com

 
pinn8

Joined: 2009-02-19
Posts: 74
Posted: Mon, 2009-07-20 19:33

Apparently I posted the message below in the wrong forum this weekend:

Nice. Two minor suggestions:

1) The text boxes are not the same size for me. For example, the word "Text" is in a box that is taller than the link itself. This makes it look a little out of balance. Ironically, it looks better in IE than in Firefox; how often can you really say that?

2) To make the screen simpler, can I suggest that you just put the link in the box, instead of typing out the URL itself? Both Firefox and IE have an option on the right-click menu to copy the URL of a link to the clipboard. This is easier to do (IMO) than having to select the content of the box by right-clicking, choosing "select all", then right-clicking again and choosing "copy.

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Tue, 2009-07-21 04:59

Glad you found it useful :)

pinn8 wrote:
1) The text boxes are not the same size for me. For example, the word "Text" is in a box that is taller than the link itself. This makes it look a little out of balance. Ironically, it looks better in IE than in Firefox; how often can you really say that?

I'll take a look at it. Are these the text boxes that show up below the photo, or the "dialog box" version (or both)?

pinn8 wrote:
2) To make the screen simpler, can I suggest that you just put the link in the box, instead of typing out the URL itself? Both Firefox and IE have an option on the right-click menu to copy the URL of a link to the clipboard. This is easier to do (IMO) than having to select the content of the box by right-clicking, choosing "select all", then right-clicking again and choosing "copy.

Hmm... Personally, I think requiring people to use the right click menu is less obvious and something that should be avoided, especially if its something that might not be available in all browsers. How it's set up now actually allows people to copy the link codes without right clicking at all -- you can single click on the beginning of the code and then drag the mouse to the end to select the text, or just triple click in the box to quickly select the whole thing. You can then either select copy from the edit menu, or press Ctrl-C instead of right clicking.
If you really want the module to work that way, you can always edit it yourself.
embedlinks\views\embedlinks_photo_block.html.php contains the code for creating links on the bottom of the photo page.
embedlinks\controllers\embedlinks.php contains the code for creating links in the dialog boxes.

 
leschek

Joined: 2006-07-29
Posts: 44
Posted: Thu, 2009-07-23 13:44

Great work,
I just have one thing. Would be possible to select the link in a box just by clicking on it instead of selecting it all by a mouse? And the boxes are too short in Firefox, so it's not so easy to select the link by mouse (especially if one make mistake and don't start selecting it from the first character).
Thank you

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Thu, 2009-07-23 15:53
leschek wrote:
Great work,
I just have one thing. Would be possible to select the link in a box just by clicking on it instead of selecting it all by a mouse? And the boxes are too short in Firefox, so it's not so easy to select the link by mouse (especially if one make mistake and don't start selecting it from the first character).
Thank you

You should be able to triple left click in the box to select the whole thing.

 
leschek

Joined: 2006-07-29
Posts: 44
Posted: Thu, 2009-07-23 22:57
Quote:
You should be able to triple left click in the box to select the whole thing.

Thank you,
That is nice trick. I would never find it myself.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2009-07-24 06:11

Highlighting and copying should be able to be done in one click with javascript.
I would use <input> not <textarea>. It forces one line and the overflow can be hidden and still work. In my opinion it looks a bit better.
This code should highlight and copy to clipboard on focus of the input form:
<input onclick="this.focus(); this.select();" name="forum" type="text" readonly="true" size="85" value="xxxxxxxxxxxxxxx" />
then some css to make the form a bit wider to fill the sidebar a bit more:

input[type="text"] {
  width: 95%;
}

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Mon, 2009-10-12 20:56

Cool thanks :) I've included your suggestions into this version of the module (and also committed them to my github).

Edit:
I've attached a second version, which includes bharat's changes for the recent API update. If you're running Beta 2 use the -new.zip version. If you're using the latest version from Git use -git.zip instead.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sat, 2009-07-25 20:30

Glad I could help. Thanks for taking my changes and creating this module. I like the clean look of the dialog box that opens up if you don't like the form on the sidebar.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Thu, 2009-07-30 00:48

Pulled! Thanks!
---
Problems? Check gallery3/var/logs
bugs/feature req's | upgrade to the latest code | use git | help! vote!

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Tue, 2009-08-25 00:53

It was requested that I modify embedlinks to display just the URLs, without any additional HTML/BBCode. The modified version is attached here and up on my github. Displaying URLs will need to be enabled from the admin screen like the HTML and BBCode options, should you wish to use the option.

 
grievousangel
grievousangel's picture

Joined: 2009-06-23
Posts: 110
Posted: Mon, 2009-08-03 01:28

OK i loaded teh new EMBEDLINKS into g3/modules. going nto test it now.

thanks,
billy

William Johnson
Statesboro, GA. 30461 USA

 
grievousangel
grievousangel's picture

Joined: 2009-06-23
Posts: 110
Posted: Mon, 2009-08-03 07:52

should you un=install then re-install EMBEDLINKS?

thanks,

William Johnson
Statesboro, GA. 30461 USA

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Mon, 2009-08-03 15:44

You should be able to just copy the new files over the old ones.

 
paulcobb

Joined: 2006-05-04
Posts: 122
Posted: Tue, 2009-08-11 15:42

I am using beta 2
I have loaded the latest version but I see nothing !
Do i need to do something to enable apart from enabling in modules?

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2009-08-11 15:59
Quote:
I have loaded the latest version but I see nothing !

Did you upgrade?
FAQ: How do I upgrade?

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
paulcobb

Joined: 2006-05-04
Posts: 122
Posted: Tue, 2009-08-11 16:16

Yep i have now.
The module is installed but i don't see any evidence that it is actually working!
Any suggestions plz

Paul

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2009-08-11 16:30

Did you activate the module?
admin-> modules

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
paulcobb

Joined: 2006-05-04
Posts: 122
Posted: Tue, 2009-08-11 16:32

Yes - it says it is activated

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Tue, 2009-08-11 16:34
paulcobb wrote:
Yep i have now.
The module is installed but i don't see any evidence that it is actually working!
Any suggestions plz

Paul

You'll need to tell the module what type of links you want it to display (HTML, BBCode, etc) and where to display it. You should see a Settings -> EmbedLinks menu option for setting this information. If you don't see it, then you're most likely not using the current version of Gallery. You can try and manually access the configuration page, its URL should look like:
http://www.example.com/gallery3/index.php/admin/embedlinks
Or you can follow the previously mentioned FAQ on Upgrading.

 
paulcobb

Joined: 2006-05-04
Posts: 122
Posted: Tue, 2009-08-11 16:38

I do not have 'embed links' on my settings menu.
I have upgraded to the latest version.

Paul

 
paulcobb

Joined: 2006-05-04
Posts: 122
Posted: Tue, 2009-08-11 16:39

I do not have 'embed links' on my settings menu.
I have upgraded to the latest version.

Paul

Edit - apologies double post!

 
paulcobb

Joined: 2006-05-04
Posts: 122
Posted: Tue, 2009-08-11 17:10

http://www.xxxxx.co.uk/gallery3/index.php/admin/embedlinks

gives

Dang... Something went wrong!
We tried really hard, but it's broken.
Talk to your Gallery administrator for help fixing this!

Edit

Upgrader reports:

Module name Installed version Available version
Comments 2 2
EmbedLinks 1 1
Gallery 3 7 7
Info 1 1
Organize 1 1
RSS 1 1
Search 1 1
Server Add 3 3
Slideshow 1 1
Tags 1 1
Users and Groups 1 1
Watermarks 1 1

Paul

 
ryanmc

Joined: 2006-10-15
Posts: 72
Posted: Tue, 2009-08-11 19:39
paulcobb wrote:
I do not have 'embed links' on my settings menu.
I have upgraded to the latest version.

Paul

I am having the same problem. I downloaded the code from github, uploaded it to my modules directory. Went to the modules menu and clicked the checkbox and the update button.

I have refreshed my browser, tried going to other pages and back, but I cannot see a menu option for embedded links.

I am able to access the settings page directly.

Any help is appreciated.

www.justechn.com

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Tue, 2009-08-11 20:25

Look all the way at the bottom of any Gallery page. Does it say "Powered by Gallery 3.0 beta 2" or "Powered by Gallery 3.0 git (pre-beta3)"?

 
ryanmc

Joined: 2006-10-15
Posts: 72
Posted: Tue, 2009-08-11 20:37
rWatcher wrote:
Look all the way at the bottom of any Gallery page. Does it say "Powered by Gallery 3.0 beta 2" or "Powered by Gallery 3.0 git (pre-beta3)"?

It says "Powered by Gallery 3.0 beta 2"

www.justechn.com

 
paulcobb

Joined: 2006-05-04
Posts: 122
Posted: Tue, 2009-08-11 21:07

Mine says the same
"Powered by Gallery 3.0 beta 2"

Paul

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Wed, 2009-08-12 04:08
ryanmc wrote:
It says "Powered by Gallery 3.0 beta 2"

www.justechn.com

paulcobb wrote:
Mine says the same
"Powered by Gallery 3.0 beta 2"

Paul

The problem is that you're running the current version of EmbedLinks from github, but not the current version of Gallery 3 from github. You can either upgrade Gallery to the version on github, or downgrade EmbedLinks to the older version that works with beta 2 (here).

 
paulcobb

Joined: 2006-05-04
Posts: 122
Posted: Wed, 2009-08-12 07:24

Thanks that has solved the problem.
It's a bit confusing regarding the different versions!

 
paulcobb

Joined: 2006-05-04
Posts: 122
Posted: Wed, 2009-08-12 07:43

I can see now what the module will actually do - unfortunately not exactly what I was hoping for.
I am trying to display all of the contents of a particular album on a remote website page. I know I could link individually to each of the images, which defeats the object of what I am trying to do. I want the contents displayed but then allowing me to change the contents of the album and the changes reflected in the remote wesite page also.
Is this possible?

Thanks

Paul

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Wed, 2009-08-12 16:31
paulcobb wrote:
I can see now what the module will actually do - unfortunately not exactly what I was hoping for.
I am trying to display all of the contents of a particular album on a remote website page. I know I could link individually to each of the images, which defeats the object of what I am trying to do. I want the contents displayed but then allowing me to change the contents of the album and the changes reflected in the remote wesite page also.
Is this possible?

Thanks

Paul

Depending on how exactly you want the remote web page to look, you could either try something like the MiniSlideshow ( http://gallery.menalto.com/node/89325#comment-315044 ), or try writing your own code. If you're familiar with php (or any other scripting language for that matter) you could probably write something that would read the album's RSS feed and display it on the remote website. Then when the album changes, the RSS feed would change as well, causing the website to change.

 
ryanmc

Joined: 2006-10-15
Posts: 72
Posted: Wed, 2009-08-12 17:25
rWatcher wrote:
ryanmc wrote:
It says "Powered by Gallery 3.0 beta 2"

www.justechn.com

paulcobb wrote:
Mine says the same
"Powered by Gallery 3.0 beta 2"

Paul

The problem is that you're running the current version of EmbedLinks from github, but not the current version of Gallery 3 from github. You can either upgrade Gallery to the version on github, or downgrade EmbedLinks to the older version that works with beta 2 (here).

Sorry to ask this question, but how do I upgrade to the latest version from github?

www.justechn.com

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Wed, 2009-08-12 17:30
 
leschek

Joined: 2006-07-29
Posts: 44
Posted: Sun, 2009-08-16 20:37

A new version of this module is great, but I have problem to translate admin part of it.

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Thu, 2010-02-25 23:36

Attached is an updated version of EmbedLinks. This version fixes the translation issue with the admin page and adds improved video support:
- Replaced references to "full size" with "Video" on movie pages.
- Automatically hide fields related to "resized" on movie pages (as this doesn't exist with videos).
- Added "embed" code for flowplayer to the "HTML Links" section of movie pages (not sure if I did the embed code right, but it seems to work).

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Thu, 2010-02-25 23:36

I've created an updated version of EmbedLinks:
- Merged in ckieffer's CSS changes for Gallery 3 Git
- Updated for the new sidebar code in Gallery 3 Git
- Tested everything against current git (as of commit b6c1ba7ea6416630b2a44b3df8400a2d48460b0a)

It is attached here, and has been uploaded to my github account.

 
Shemo725

Joined: 2008-04-18
Posts: 424
Posted: Mon, 2009-12-07 03:05

is there a way to make this type of link in the URL section?

[img]link to photo[/img]

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Wed, 2009-12-16 03:17
Shemo725 wrote:
is there a way to make this type of link in the URL section?

[img]link to photo[/img]

I believe that type of link is generated in the BBCode section.

 
TTC

Joined: 2010-02-23
Posts: 2
Posted: Tue, 2010-02-23 15:17

Just tried this plugin with G3 Beta3.

The option to "Show Links In The Actual Page" works fine, however I'd like the links to be unobtrusive. When I activate the "Show Links In a Seperate Dialog Box" I can't find anything on the page to click to give me the links.

Does it with with Beta3?

What should I be seeing and where???

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Wed, 2010-02-24 20:30
TTC wrote:
Just tried this plugin with G3 Beta3.

The option to "Show Links In The Actual Page" works fine, however I'd like the links to be unobtrusive. When I activate the "Show Links In a Seperate Dialog Box" I can't find anything on the page to click to give me the links.

Does it with with Beta3?

What should I be seeing and where???

You should see buttons on the sidebar, similar to the EXIF button (if you use that module). It should work fine if you upgrade to RC1.