Linking to gallery instead of photo with image block

BillWill

Joined: 2008-08-28
Posts: 205
Posted: Wed, 2011-09-07 02:45

After much searching, I was happy to see that it is possible for the random photos used in image block to link to their album rather than the same image within a gallery. I found where to download the files here:

http://gallery.menalto.com/node/76588

I uploaded the new files yesterday, and it worked fine for awhile, and then the random photos stopped appearing on the pages where I was using this code:

<?php @readfile('http://www.mysite.com/gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_exactSize=550&g2_linkTarget=_blank&g2_itemId=298451'); ?>

After much troubleshooting, I uninstalled and deleted image block, and reinstalled it via the admin panel.

The random images appeared again as expected, until I uploaded the new files. Now, again, the random photos do not appear on my site.

I deleted the template cache, as well as the database cache.

Is there some tweak required to make this modification work so that random images will appear as expected, and the link is to the album and not the image?

Thanks,
bw

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2011-09-07 02:50
 
BillWill

Joined: 2008-08-28
Posts: 205
Posted: Wed, 2011-09-07 03:52

No, I haven't, but am trying it now. I looked the four examples presented here:

http://www.flashyourweb.com/staticpages/index.php?page=mediaBlock

As well as the table, but can't quite figure out how to accomplish what I want.

What I have so far is this:

mediaBlock.php?g2_itemId=298451&limit=1&shuffle=1; width=550, height=367');

However, this links to the photo rather than the album, and the sizes I want to set are ignored.

Do you know how to modify the line so that the image is the size I want, and that clicking on the image links to the album?

Thanks for the suggestion,
bw

Gallery 2.3
PHP - 5
linux/apache
mysql database
matrix theme

Gd and image magick toolkits

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2011-09-07 10:47

Sorry, thought mediaBlock had linkToParent the same as mediaRss.php does in the minislideshow.
edit function getLink to look like:

function getLink($item) {
    global $gallery;
    $id = (isset($_REQUEST['linkToParent']) && $_REQUEST['linkToParent'] == 1)?$item->parentId:$item->getId();
    $urlGenerator = &$gallery->getUrlGenerator();
    $link = $urlGenerator->generateUrl(array('view'=>'core.ShowItem', 'itemId'=>$id), array('forceFullUrl'=>true, 'forceSessionId'=>false));
    return $link;
}

then you can use it:
mediaBlock.php?g2_itemId=298451&limit=1&shuffle=1&linkToParent=1

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

 
BillWill

Joined: 2008-08-28
Posts: 205
Posted: Wed, 2011-09-07 13:33

Thanks for the update. Still don't see how to resize the images.

I tried two ways, neither of which worked:
mediaBlock.php?g2_maxImageHeight=367&g2_maxImageWidth=500&g2_itemId=190200&limit=1&shuffle=1&linkToParent=1&linkTarget=blank;')
mediaBlock.php?g2_exactSize=500&g2_itemId=190200&limit=1&shuffle=1&linkToParent=1&linkTarget=blank;');

What am I mising?

Also, where did you find the linkToParent? I looked all over http://www.flashyourweb.com/staticpages/index.php?page=mediaBlock and didn't see it. Is there another source for parameters?

Thanks again,
bw

Gallery 2.3
PHP - 5
linux/apache
mysql database
matrix theme

Gd and image magick toolkits

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2011-09-07 21:45

mediaBlock does not build image resizes, they have to already exist. It then retrieves the closest resize to your parameters.
use g2_maxImageHeight=367&g2_maxImageWidth=500
You can further control the image display size with useMicro but then its only html resizing.

Quote:
Also, where did you find the linkToParent?

its part of my mediaRss for the minislideshow - I usually copy useful features to both scripts.

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

 
BillWill

Joined: 2008-08-28
Posts: 205
Posted: Mon, 2011-09-26 17:34

Here's where I am with this:

I only have one size on my album.

I was using ImageBlock to display images on other websites not owned by me who wanted images from a particular album.

I didn't like link to the image, so I changed the code to link to that gallery.

I tired your two suggestions, and am still not where I want to be. The slideshow is very cool, but takes a long time to start, isn't showing in IE 8, and some people have complained it gives the flash warning with the option to stop the script.

So I tried falling back to your other suggestion of Mediablock, but can't figure how from your explanation how have the image resized to fit the different sites that want it.

You mentined the useMicro to do an html resize. It seems that only afects thumbnails, and even if id didn't it seems like I'd have to make multiple copies of mediaBlcok.php and tweak them each time I wanted a new size.

I starting to think what I need is not possible with either of the two scripts you suggested. Maybe imageblock won't work either if I throw in the link to parent.

Is it possible for me to get what I want from any of these?

Display a random photo from a specific album on a specific site
Adjust the size display differently each time
Have the random photo link to the album on my site, not the photo on my site.

I had two out of three when I changed the code in imageblock, and it was very easy to do.

Does imageblock not support the link to parent as suggested in the other post I Referenced? Is there an easy way to resize (via html) the random image it generates as easily as imageblock?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2011-09-26 18:09

mediaBlock will only display image sizes already built.
You could extend useMicro to work with larger images in mediaBlock, or study the hacked imageblock module to see how that user did it and fix it yourself.
But there seems to be nothing out of the box that will do what you want.

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

 
BillWill

Joined: 2008-08-28
Posts: 205
Posted: Mon, 2011-09-26 19:13

That's too bad. Each one came sooo close.

Thanks for you help!

 
BillWill

Joined: 2008-08-28
Posts: 205
Posted: Mon, 2011-09-26 19:49

Figured it out!!!

External Image Block will do all three things I wanted:

Display random photo on an external site, easily change its display size for each site, and link to the parent album instead of the image displayed.

I deleted Image Block plugin and started over with a fresh install.

Then for then used this to link the random image to the album:

g2_link=/gallery2/main.php?g2_itemId=234678

(itemID in this case is the album)

So the total line is this:

<?php @readfile('http://www.mysite.com/gallery2/main.php?g2_view=imageblock:External&g2_blocks=randomImage&g2_exactSize=500&g2_link=/album/main.php?g2_itemId=234678&g2_linkTarget=blank&g2_itemId=234678'); ?>

Hope this helps someone with the same goal.