Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#481 2007-01-28 17:43:54

aswihart
Member
From: Pittsburgh, PA
Registered: 2006-07-22
Posts: 345
Website

Re: [plugin] [ORPHAN] vdh_flickr

Ralph,
I don’t know for sure if this is possible, but I’m trying to implement LightBox with the link to original_size image for a nice touch to the presentation of the large image.

I have the Lightbox set up and working as I have tested it with other non-vdh_flickr images on the page. All that you have to do to implement it on an image is to add a rel=“lightbox” to the link. I looked through the code and tried something that didn’t work (shown below), big surprise since I don’t know php. I’m not even 100% sure if I’m looking at the right part of code.

I wonder if you know off-hand how I can add the rel=“lightbox” to all the original_size links. Thanks for any help, I know you’re busy though.

 function img_link($img_url) {
    if (isset($this->link)){
      switch($this->link) {
        case "flickr":
          $this->link = 'http://www.flickr.com/photos/' . urlencode($this->nsid) . '/' . $this->id . '/';
          break;
        case "original_size":
          $this->link = $this->getPhotoUrl($this->server, $this->id, $this->secret, $this->original_size);
          break;
        case "img_information":
          $this->link = 'http://www.flickr.com/photo_exif.gne?id=' . $this->id;
          break;
      }
      $img_url = tag($img_url,'a',' href="' . $this->link . '"',' rel="lightbox"')."\n";
    }
    return $img_url;
  }

Last edited by aswihart (2007-01-28 17:50:54)

Offline

#482 2007-01-28 18:01:12

ralph
Member
Registered: 2005-02-28
Posts: 106

Re: [plugin] [ORPHAN] vdh_flickr

Search for the function thumbnails_link and change it like this:

 function thumbnails_link($img_url) {
    if($this->open == 'self') {
      if (isset($this->set)) {
        $parameters['set'] = $this->set;
      }
      $parameters['img'] = $this->photo['id'];
      $html = tag($img_url,'a',' href="'. $this->makeRequest($parameters) .'"')."\n";
    }
    if($this->open == 'flickr') {
      $html = '<a href="http://www.flickr.com/photos/' . urlencode($this->nsid) . '/' . $this->photo['id'] . '/">' . "\n";
      $html .= $img_url;
      $html .= '</a>' . "\n";
    }
    if($this->open == 'window') {
      $html = '<a href="';
      $html .= $this->getPhotoUrl($this->photo['server'], $this->photo['id'], $this->photo['secret'], $this->img_size);
      $html .= '" onclick="window.open(this.href, \'popupwindow\', \'resizable\'); return false;">';
      $html .= $img_url;
      $html .= '</a>';
    }
    if($this->open == 'lightbox') {
      $html = '<a href="';
      $html .= $this->getPhotoUrl($this->photo['server'], $this->photo['id'], $this->photo['secret'], $this->img_size);
      $html .= '" rel="lightbox">';
      $html .= $img_url;
      $html .= '</a>';
    }
    return $html;
  }

Offline

#483 2007-01-28 19:26:50

aswihart
Member
From: Pittsburgh, PA
Registered: 2006-07-22
Posts: 345
Website

Re: [plugin] [ORPHAN] vdh_flickr

Ralph,
That is working beautifully for my vdh_flickr_thumbnails for my latest pics on the front page, and also when in the thumbnails view of vdh_flickr. Would it be possible to add the vdh_flickr_img_description or vdh_flickr_img_title to this link as title="vdh_flickr_img_title" so that it appears in lightbox? Not to mention stuff like date taken and the tag list, if there was some way to get that info to display in LightBox, we’d really be in business.

The coolest thing that would be possible is if you could add rel="lightbox[set#]" where set# is a unique string identifying all the photos in the current set, pretty much fully integrating the Lightbox gallery function with vdh_flickr. This is probably more work, but what do I know, maybe you just have to plug a variable in there and it will all work out (crossing my fingers).

I think what you’ve given me is a neat alternative to the img form of vdh_flickr, but it’s different than what I was thinking. What I originally wanted was for LightBox to work when displaying the original_size image, which is linked to using the <txp:vdh_flickr_img_link> tag on the img form. Is this possible?

This way you would get to each individual photo page with all the details like: date taken, tag list, image title / description, and you wouldn’t have to worry about getting all this info to display in Lightbox somehow.
Andrew

Last edited by aswihart (2007-01-28 20:00:58)

Offline

#484 2007-01-29 08:55:36

ralph
Member
Registered: 2005-02-28
Posts: 106

Re: [plugin] [ORPHAN] vdh_flickr

Ah, now I see what you wanted initially. Just change the following function like this:

  	function img_link($img_url) {
		if (isset($this->link)){
			switch($this->link) {
				case "flickr":
				$link_target = 'http://www.flickr.com/photos/' . urlencode($this->nsid) . '/' . $this->id . '/';
				break;
				case "original_size" || "lightbox":
				$link_target = $this->getPhotoUrl($this->server, $this->id, $this->secret, $this->original_size);
				break;
				case "img_information":
				$link_target = 'http://www.flickr.com/photo_exif.gne?id=' . $this->id;
				break;
			}
			$link_attributes = ' href="' . $link_target . '"';
			if ($this->link == "lightbox") {
				$link_attributes .= ' rel="lightbox"';
			}
			$img_url = tag($img_url, 'a', $link_attributes);
			$img_url .= "\n";
		}
		return $img_url;
	}

Offline

#485 2007-01-29 15:11:27

aswihart
Member
From: Pittsburgh, PA
Registered: 2006-07-22
Posts: 345
Website

Re: [plugin] [ORPHAN] vdh_flickr

Ralph,
Beautiful, thanks a lot man. Maybe consider these little changes for the next version with links to the Lightbox scripts for those interested.

I have my original_size set to “b” so most modern monitors can get all or most of the large image on the screen, and this way, you don’t feel like you’re leaving my site temporarily to see the large version. I had to add an empty div below the image on the img form so the LightBox shading fills the entire area. Another hindrance is that some of my smaller uploaded images on Flickr don’t display at this size, so I might have to upscale them and re-upload for it to work with them.

Thanks again, you give me reason to learn PHP. Just got my first Javascript book the other day, first things first.
Andrew

EDIT: I have discovered that your image’s longest side must be 1281px or greater for Flickr to generate a “large” size (corresponding to vdh_flickr size “b” which is 1024px on the longest side). That’s right, common 1280px images get no “large” size love. I had to create a Photoshop batch process to increase hundreds of photos by 0.1% and re-upload to flickr. It was worth it though, now they all display great in large view with LightBox.

Last edited by aswihart (2007-01-30 01:39:13)

Offline

#486 2007-02-08 04:19:31

photonomad
Member
Registered: 2005-09-10
Posts: 290
Website

Re: [plugin] [ORPHAN] vdh_flickr

I made the modifications specified in #483, but I can’t figure out how to get the rel=“lightbox” attribute to show up in the image link. I’m sure I’m just missing something simple, but I am at a loss….

<txp:vdh_flickr nsid="32353423@N00" set_form="preview" thumbnails_form="thumbnails" img_form="image" thumbs_per_page="16" set_preview_size="m" thumbnail_size="s" img_size="n" original_size="b" link="original_size"/>
<txp:vdh_flickr_img_link><txp:vdh_flickr_img_naked /></txp:vdh_flickr_img_link>

Offline

#487 2007-02-08 06:15:48

aswihart
Member
From: Pittsburgh, PA
Registered: 2006-07-22
Posts: 345
Website

Re: [plugin] [ORPHAN] vdh_flickr

Without using vdh_flickr, have you tested lightbox on the page you are using to make sure it’s working?

other than that, if you cut and paste the code in #483, i think it should just work, basically replacing the img_form tier of the three tiered system with a lightbox pop-up.

The code in #485 that I’m using does require you to specify link=“lightbox” in your vdh_flickr tag, however.

Last edited by aswihart (2007-02-08 06:16:48)

Offline

#488 2007-02-08 19:19:42

aswihart
Member
From: Pittsburgh, PA
Registered: 2006-07-22
Posts: 345
Website

Re: [plugin] [ORPHAN] vdh_flickr

Ralph – I tried using <txp:vdh_flickr_tag_list_all> and I’m getting “Array” repeated over and over again instead of a tag list. Is this broken or am I missing something?

Offline

#489 2007-02-08 20:10:28

ralph
Member
Registered: 2005-02-28
Posts: 106

Re: [plugin] [ORPHAN] vdh_flickr

It seems to be broken with php4. I don’t know yet when I will be able to fix this.

Offline

#490 2007-02-08 20:20:52

aswihart
Member
From: Pittsburgh, PA
Registered: 2006-07-22
Posts: 345
Website

Re: [plugin] [ORPHAN] vdh_flickr

I thought I was using PHP5, since your plugin never worked for me until my host enabled PHP5 on my server. Although my host enables PHP5 through some method called FastCGI, and in the admin panel diagnostics in TXP, it does say I have PHP 4.4.4.

I also just went into the plugin and changed the part near the top that says if(!($mainversion >= 5)) { $GLOBALS['use_php4'] = 0;}.

As you can see I changed the last part to 0 instead of the default 1, I thought this forces the use of PHP5. And the plugin is still working so I think I have PHP5 enabled, and still getting the problem with the tag list.

Just letting you know, I know you don’t have time to fix this right now.

Last edited by aswihart (2007-02-08 20:23:19)

Offline

#491 2007-02-10 14:57:14

aswihart
Member
From: Pittsburgh, PA
Registered: 2006-07-22
Posts: 345
Website

Re: [plugin] [ORPHAN] vdh_flickr

Ralph,
I was fiddling around trying to add the attribute title= to the lightbox code you added that goes:

if ($this->link == "lightbox") {
				$link_attributes .= ' rel="lightbox"';
			}

Alas, I have no idea what I’m doing and I keep breaking it. I figure there must be an easy way to add the current image title as a title attribute in the link. This will display in Lightbox (Slimbox for me now).
Andrew

Last edited by aswihart (2007-02-10 15:04:34)

Offline

#492 2007-02-10 15:34:25

photonomad
Member
Registered: 2005-09-10
Posts: 290
Website

Re: [plugin] [ORPHAN] vdh_flickr

Lightbox is working for me without vdh_flickr.

When I click on an image using vdh_flickr, it takes me to a url with /lightbox at the end – a 404 page — so it is working as a link address and not creating the rel=“lightbox” attribute. I re-installed the latest version of vdh_flickr and the only change I made to the code is what is posted in #485 of this forum thread. I am using vdh_flickr 0.8.9 with txp 4.0.4

My host (Bluehost) is using PHP 4.4.4 — I just requested that they upgrade mine to PHP5 — it will take about a day because they will migrate it to a different server.

If that isn’t the cause of the problem, then I am still stumped! Any other suggestions?

Offline

Board footer

Powered by FluxBB