Plugin for generating links to the current photo...

rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Fri, 2011-08-05 05:33

I've removed the checkbox on the EmbedLinks admin page for enabling / disabling the buttons on the sidebar (this isn't necessary anymore with the dynamic sidebar feature in Gallery 3). The new code can be downloaded from this post, or from my github account.

 
Ptechnix

Joined: 2010-03-04
Posts: 2
Posted: Thu, 2010-03-04 18:35

Hi rWatcher,

Firstly I want to say thanks for the great module. But I was just wondering one of two things since I have to admit I'm completely new to this. Is there a function to batch generate links as opposed to just individually for each photo?

I was hoping to either be able to select x number of photos and generate the links for them, or for all the photos in an album.

Secondly, can you advise as to which file I would have to modify if I would like to edit the link generator to specify my own custom link prefixs/suffixes? That would be wonderful if at all possible to do. Thanking you in advance, keep up the stellar work :)

I apologise in advance if the feature is already there and that I've somehow overlooked it.

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Thu, 2010-03-04 19:25
Ptechnix wrote:
Hi rWatcher,

Firstly I want to say thanks for the great module. But I was just wondering one of two things since I have to admit I'm completely new to this. Is there a function to batch generate links as opposed to just individually for each photo?

I was hoping to either be able to select x number of photos and generate the links for them, or for all the photos in an album.

Secondly, can you advise as to which file I would have to modify if I would like to edit the link generator to specify my own custom link prefixs/suffixes? That would be wonderful if at all possible to do. Thanking you in advance, keep up the stellar work :)

I apologise in advance if the feature is already there and that I've somehow overlooked it.

Sorry, there isn't a batch-generate option. There is an option for generating links to albums instead of photos, perhaps you could use the album link instead?

Links for the dialog boxes are generated in the modules\embedlinks\controllers\embedlinks.php file.
Links for the "in-page" option are generated in modules\embedlinks\views\embedlinks_photo_block.html.php and modules\embedlinks\views\embedlinks_album_block.html.php.

 
Ptechnix

Joined: 2010-03-04
Posts: 2
Posted: Sun, 2010-03-07 04:26

Thanks for the reply! This is the hard part and so far I haven't found any alternatives to this. I'm moving from photobucket and their primary feature which I really loved was the ability to select all the photos in an album, and generate en masse the links for them. Because when I'm putting all the photos on a post in a blog for example, it will be in a whack of about 70-80. So that's a lot of html links to manually generate. Photobucket is exceptional in this regard to the flexibility of batch link generation.

Because I want to manually display all the photos, I can't just do a simple album link unfortunately. So far I haven't found any image hosting application that does this whether it be Gallery, Shozam, Coppermine, etc as far as I'm aware :( This is the feature that I'm looking for primarily.

If you have any knowledge of any modules or software that has this, it would be greatly appreciated if you could let me know. Thanks!

 
Lord Beowulf
Lord Beowulf's picture

Joined: 2010-03-31
Posts: 56
Posted: Wed, 2010-07-14 04:14

Hey rWatcher,

I'm working on some mods to this to put a link icon at the top of the sidebar rather than the buttons somewhere down the side. I still have some work to do in the administration, etc. but you can take a look at it here [img]http://photos.orionranchobservatory.com/var/thumbs/Astrophotography/IC434%20-%20Horsehead%20Nebula%20Wide%20Field%20-%20090219b%20crop.jpg?m=1277091085[/img] if you're interested.

Beo

 
Lord Beowulf
Lord Beowulf's picture

Joined: 2010-03-31
Posts: 56
Posted: Mon, 2010-07-26 12:33

Ok, I've done quite a few updates to this, so I thought I'd share. These include:

1. Adding a link icon to the top menu that will bring up the latest dialog.
2. Adding navigation buttons to each dialog to allow switching to the others (thanks Bharat!).
3. Adding support for the IE "copy to clipboard" function.
4. Various display options for the new features.

I didn't add any customization for removing the sidebar dialog, since you can do that in the sidebar organizer.

I've worked out most of the issues, but there's one known problem. Once you display a given dialog on the page, it won't display again unless you refresh the page. If anyone knows how to fix that, I'd welcome the input.

You can see all of this in operation on my website posted in the previous message.

Thanks,

Beo

 
Chris_Eric

Joined: 2010-12-01
Posts: 2
Posted: Wed, 2010-12-01 21:15

Hello. This is a great module.
I will work with the bb-code in a forum, but it doesn't works.

The Problem is, the bb-code must ending on: .jpg oder .png or whatever. But the ending on the bb-code is at the moment: .png?m=1291216240

for example at the moment:

Quote:
[img ]url/var/resizes/albumname/filename.png?m=1291216240[/img ]

and i need:

Quote:
[img ]url/var/resizes/albumname/filename.png[/img ]

or

Quote:
[img ]url/var/resizes/albumname/m=1291216240-filename.png[/img ]

or whatever.

I hope you can follow me. And sorry for my english.

 
jpvdgiessen

Joined: 2010-12-01
Posts: 43
Posted: Mon, 2010-12-06 21:56

I've noticed the hyperlink has some "internal id" but the link to the thumbs or resized images has the full path:

<a href="http://www.bijbelaantekeningen.nl/gallery3/photos/1789"><img src="http://www.bijbelaantekeningen.nl/gallery3/var/thumbs/Flora/Embryophyta/Spermatopsida/Ranunculales/Ranunculaceae/DSC00750.JPG?m=1291473070"></a>

<a href="http://www.bijbelaantekeningen.nl/gallery3/photos/1789"><img src="http://www.bijbelaantekeningen.nl/gallery3/var/resizes/Flora/Embryophyta/Spermatopsida/Ranunculales/Ranunculaceae/DSC00750.JPG?m=1291473070"></a>

What I'm looking for is also an "internal id" for the images, because if reorganizing the albums (ie moving an image to an other album) I also have to check al embedded links (in my case if going operational there will be more then 100.000 photos's)

I've posted this question before on http://gallery.menalto.com/node/99544 where I give some more details.

JP

 
jpvdgiessen

Joined: 2010-12-01
Posts: 43
Posted: Sun, 2010-12-12 15:16

Chris,

I suppose you've tried deleting the "?m=1291216240" extension.

 
Chris_Eric

Joined: 2010-12-01
Posts: 2
Posted: Mon, 2010-12-13 07:31

hm, yes. I can delete the "?m=1291216240" extension, but if a filename double oder triple in the gallery, the gallery works right? All images works, also the double and triple images?

 
jpvdgiessen

Joined: 2010-12-01
Posts: 43
Posted: Mon, 2010-12-13 10:53

Chris,

I'm also a newbie, but as far I can see double or triple images are not possible in a directory (or the original has .png, .gif and .jpg).
If you have the possibility check the /var/albums directory and you can see how the images are stored.

JP

 
jpvdgiessen

Joined: 2010-12-01
Posts: 43
Posted: Tue, 2010-12-14 20:29

Some days ago I wrote:

jpvdgiessen wrote:
I've noticed the hyperlink has some "internal id" but the link to the thumbs or resized images has the full path:

<a href="http://www.bijbelaantekeningen.nl/gallery3/photos/1789"><img src="http://www.bijbelaantekeningen.nl/gallery3/var/thumbs/Flora/Embryophyta/Spermatopsida/Ranunculales/Ranunculaceae/DSC00750.JPG?m=1291473070"></a>

<a href="http://www.bijbelaantekeningen.nl/gallery3/photos/1789"><img src="http://www.bijbelaantekeningen.nl/gallery3/var/resizes/Flora/Embryophyta/Spermatopsida/Ranunculales/Ranunculaceae/DSC00750.JPG?m=1291473070"></a>

What I'm looking for is also an "internal id" for the images, because if reorganizing the albums (ie moving an image to an other album) I also have to check al embedded links (in my case if going operational there will be more then 100.000 photos's)

I've posted this question before on http://gallery.menalto.com/node/99544 where I give some more details.

Is this possible, or will this be in a future release and if so, how long do I have to wait for this new release. Or could someone give me some hints how I can build this in.

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Fri, 2011-08-05 05:39

Here is the latest version of the embedlinks module. It has been fully tested against Gallery 3.0.2.

Changes in this version:
-- Updated module.info for G3.0.2
-- Fixed the flowplayer embed code to work properly with the latest version of Gallery 3.
-- Updated the flowplayer embed code to support the videos module.
-- Added the toolbar icon from Lord Beowulf's mod into the module -- Toolbar icon leads to a "tabbed" dialog containing HTML/BBcode/URLs. This can be turned off from the admin screen.
[img]http://gallery.menalto.com/files/linktothispagedialog.png[/img]

 
Chasden

Joined: 2012-01-02
Posts: 51
Posted: Mon, 2012-01-02 02:27

Hello,
Could you tell me how to increase the width of the input areas? They are much too short. I tried using the "size" attribute in the html pages, but i can't get the input areas to lengthen.

It would also be nice to center them on the page. Could you please tell me how to do that as well?

Thanks.

Example page is here: http://rashadface.com/index.php/tag_albums/show/16/11/0/ramp-ari3.jpg

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2012-01-04 00:37

looks to me like you fixed it. I bet it was some CSS fix. You might want to post what you did to contribute back to the community.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Chasden

Joined: 2012-01-02
Posts: 51
Posted: Wed, 2012-01-04 19:14

You're right. Sorry for not keeping you updated.

I'm re-editing the file right now to include comments (pet peeve of mine is editing a file, and publishing it WITHOUT adding comments to explain your edits. It seems that EVERY coder does it though!)

Will post when it's ready.

 
Chasden

Joined: 2012-01-02
Posts: 51
Posted: Wed, 2012-01-04 19:14

Here is what i did.

This is not an elegant solution! In fact, it will disable the "Show Full URL" functionality of your module. I highly recommend you look at this file in a program that highlights code by color, such as EditPlus. It will make it easier to read my comments and understand what is changing. You should turn on Word Wrap by going to Document -> Word Wrap in the menu bar, to make it easier to read.

1. I went to /modules/embedlinks/views/ and edited the "embedlinks_photo_block.html.php" file. Specifically, i went to line 184 (which begins the "Full URL" portion of the code)

2. I edited the code (see code blocks below for "before" and "after")

3. I went to Admin Panel. Went to Settings -> EmbedLinks. I have only 2 boxes checked: "Show the full URL" and "Show Links In The Actual Page". I chose Full URL mode because it was the shortest one (4 text boxes). "Show BBCode Links" mode has something like 12-16 text boxes...WAY too many options for the average user. I didn't want to overwhelm the user with options. A thumbnail and a large image is really all they need.

Hope this helps!

The old lines 184 to 217 look like this:


<? if (module::get_var("embedlinks", "FullURL")) { ?>
<h3 align="center"><?= t("URLs")?></h3>
<table class="g-embed-links">
  <tbody>
    <tr>
      <th><?= t("This Page:") ?></th>
      <td><input type="text" value="<?= url::abs_site("{$item->type}s/{$item->id}") ?>" onclick="this.focus(); this.select();" readonly></td>
    </tr>

    <tr>
      <th><?= t("Thumbnail:") ?></th>
      <td><input type="text" value="<?= $item->thumb_url(true) ?>" onclick="this.focus(); this.select();" readonly></td>
    </tr>

  <? if ($item->is_photo()) { ?>
    <tr>
      <th><?= t("Resized:") ?></th>
      <td><input type="text" value="<?= $item->resize_url(true) ?>" onclick="this.focus(); this.select();" readonly></td>
    </tr>
  <? } ?>
  
<?  if (access::can("view_full", $item)) { ?>
    <tr>
      <? if ($item->is_movie()) { ?>
      <th><?= t("Video File:") ?></th>
      <? } else { ?>
      <th><?= t("Full size:") ?></th>
      <? } ?>
      <td><input type="text" value="<?= $item->file_url(true) ?>" onclick="this.focus(); this.select();" readonly></td>
    </tr>
<? } ?>

  </tbody>
</table>

The new code now goes from lines 184 to 227, and looks like this (comments are mine, just to better explain my usage):

<? if (module::get_var("embedlinks", "FullURL")) { ?>
<!-- Comments below are from Chasden, to go with my post in the EmbedLinks thread, located at 
http://gallery.menalto.com/node/88322?page=1#comment-385769  -->
<h3 align="center"><?= t("Share/Hotlink this image on Forums")?></h3> <!-- The title of the EmdedLinks box goes in the quotes -->
<table class="g-embed-links">
  <tbody>
    <tr>
      <th><?= t("This Image:") ?></th> <!-- The text you want next to Link #1 goes in the quotes -->
      <td><input type="text" value="<?= $item->file_url(true) ?>" onclick="this.focus(); this.select();" readonly></td>
    </tr> <!-- I didn't change the above at all -->

    <tr>
      <th><?= t("BBCode (Thumbnail):") ?></th> <!-- The text you want next to Link #2 goes in the quotes -->
      <td><input type="text" value="[url=<?= url::abs_site("{$item->type}s/{$item->id}") ?>][img]<?= $item->thumb_url(true) ?>[/img][/url]" onclick="this.focus(); this.select();" readonly></td> 
    </tr> <!-- Added [URL=  ...  ] and [img] tags around the php code that already there. If you don't want BBCode, just edit the BBCode to be something else. The stuff in between the <question marks> is always the URL of the image, so don't edit it -->

  <? if ($item->is_photo()) { ?>
    <!-- THIS IS WHERE I GOT THE BOXES TO BE WIDER 
		I believe you could make this change anywhere. I'm not sure why i only had to do it once.
		Look on Line 209. Right after the [/url] tag, i added size="120".
		That made ALL FOUR text boxes stretch to 120 spaces wide for some reason.
		If this doesn't work, you could try adding size="120" to all four text boxes -->
    <tr>
      <th><?= t("BBCode (Forum Size):") ?></th> <!-- The text you want next to Link #3 goes in the quotes -->
      <td><input type="text" value="[url=<?= url::abs_site("{$item->type}s/{$item->id}") ?>][img]<?= $item->resize_url(true) ?>[/img][/url]" size="120" onclick="this.focus(); this.select();" readonly></td> <!-- Added [URL=  ...  ] and [img] tags around the php code that already there -->
    </tr>
  <? } ?>
  
<?  if (access::can("view_full", $item)) { ?>
    <tr>
      <? if ($item->is_movie()) { ?>
      <th><?= t("Video File:") ?></th> <!-- No change here, because i don't have any videos on my site. But the conventions are the same. Just wrap whatever BBCode you use to make videos work, usually [youtube] ... [/youtube]  or [yt] ... [/yt] -->
      <? } else { ?>
      <th><?= t("HTML (Medium):") ?></th> <!-- The text you want next to Link #4 goes in the quotes -->
      <? } ?>
      <td><input type="text" value="<a href=&quot;<?= url::abs_site("{$item->type}s/{$item->id}") ?>&quot;><img src=&quot;<?= $item->resize_url(true) ?>&quot;></a>" onclick="this.focus(); this.select();" readonly></td> <!-- This one is HTML embed code, NOT BBCode. I just put it here in case users want to see it -->
    </tr>
<tr>

</tr>	
<? } ?>

  </tbody>
</table>	<!-- If you have Google Adsense banner ad info, you can put it right here, and you'll get a banner ad below your Embed Codes. Put <center> .... </center> around it so it lines up properly -->
	
 
RalphTheWonderLlama

Joined: 2005-07-16
Posts: 68
Posted: Wed, 2012-01-25 04:46

Fantastic module. Is that a newer version than the one in the link in the first post of this thread "Get latest version"? I ask because mine doesn't quite look like that with the tabbed stuff.

---

EDIT - Ah nevermind, I see that after checking the settings, there is the additional chain link icon in the top right that opens that tabbed version of the module. Excellent.

 
Troutstudio

Joined: 2012-03-28
Posts: 4
Posted: Wed, 2012-03-28 22:13

I was so happy to see this module! I do have a feature request, but I have no idea how difficult this would be.

Photobucket also gives you IMG CODE links; which work much better for inline images on many PHP forums. Flickr doesn't do this. So the code I need for all my music forums (sorry to sound self interested here) is:

IMG (surrounded by square brackets) the_url_goes_here /IMG (surrounded by square brackets) Is this hard to do? I would gladly make a donation for this. Anyway - please don't think I don't already appreciate your work, because I can just strip the "<a href= etc from your HTML links. Just thought it might be a cool thing to have. Thanks very much for your work.

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Thu, 2012-03-29 00:22
Troutstudio wrote:
I was so happy to see this module! I do have a feature request, but I have no idea how difficult this would be.

Photobucket also gives you IMG CODE links; which work much better for inline images on many PHP forums. Flickr doesn't do this. So the code I need for all my music forums (sorry to sound self interested here) is:

IMG (surrounded by square brackets) the_url_goes_here /IMG (surrounded by square brackets) Is this hard to do? I would gladly make a donation for this. Anyway - please don't think I don't already appreciate your work, because I can just strip the "<a href= etc from your HTML links. Just thought it might be a cool thing to have. Thanks very much for your work.

The module already generates this tag for a photo's "resized" url -- it's under the bbcode button:
[img]http://gallery.menalto.com/files/bbcode_img_tag.png[/img]
If you don't see a "Show BBCode" option, you may need to enable it from Admin -> Settings -> EmbedLinks.

Is that what you were looking for, or did you need img tags for something other then the resized url?

 
Troutstudio

Joined: 2012-03-28
Posts: 4
Posted: Thu, 2012-03-29 00:49

That's it! I'm just blind. Fantastic thank you.

 
inchains

Joined: 2012-04-19
Posts: 18
Posted: Tue, 2012-05-22 14:24

How can I change the module so that it is shown only to registered users, and possibly to a group only?

Thank you.

________________________________
API:
- Gallery 3.0.3
Server:
- Apache 2.2.22
- PHP 5.2.17
- MySQL 5.1.61-community-log
- OS linux x86_64

 
thecroztm

Joined: 2010-08-28
Posts: 13
Posted: Wed, 2012-10-10 15:48

Brilliant module! Just what I needed...thanks.

 
thecroztm

Joined: 2010-08-28
Posts: 13
Posted: Wed, 2012-10-10 17:25

One quick ask: Is it possible to add rel="lightbox" to the "Link to resized image (Thumbnail)" output so the thumbnail triggers Lightbox2? Wondering...

 
Dande

Joined: 2009-09-21
Posts: 2
Posted: Mon, 2012-11-05 20:01

I have some problems with this module. I am just playing around a little bit to set up my photo page. Currently I am using the GreyDragon Theme and the Sidebar Blocks look strange. Also the popup with (the one you get when clicking the icon) is working but looks very strange (see attached file).
Using the Wind theme everything is ok.
Using the clean canvas theme there is only a linebreak issue in the sidebar. The same can be seen in the attached image, there is a line break missing between the "show BBCode" and "Show URL".
I already tried to deactivate all other modules, sidebar elements and played around with the theme settings.

Can somebody help me with this problem?

Thank you.

 
Dande

Joined: 2009-09-21
Posts: 2
Posted: Thu, 2012-11-08 20:48

Ok, I was able to fix the missing line break in the sidebar block. There was a line break missing in the embedlinks_sidebar.html.php. At least I think there should be a linebreak. I attached my version.

rWatcher could put my file in the module?

For the strange look of the popup I have no clue how to solve this. I don't even understand which code is used to generate the popup.

 
Lord Beowulf
Lord Beowulf's picture

Joined: 2010-03-31
Posts: 56
Posted: Tue, 2013-01-01 15:14

Hi all! Been a while since I've been around. The gallery's been working pretty well and I've been spending my time generating content rather than editing the gallery. However, I just let the system upgrade to V3.04 which broke my theme, etc. and am now bringing other modules up to date. rWatcher, nice changes to the control. I like the tabbed approach. Only two comments there that I may try to address if I get the time. Both relate to behavior when the dialog is displayed. The first is simply that the active tab isn't highlighted. The second is that it always defaults to HTML. I'd come up with a scheme that remembered the last active mode so that when I'm copying lots of links, I don't have to navigate any more than necessary. I understand that may not be desirable for everyone, so maybe it could be an admin option. And I'll second the desire to lose the ?m=1356467817 extension since I always have to manually edit that out for the websites where I post bbcode. I may have a look into that as well.

At any rate, great work. Hope to have time to check in more often, but probably won't! =)

Beo

---------------------------------------------
Visit http://photos.orionranchobservatory.com