Swap - swap main image AND thumbnail Will Pay

Phoca Gallery - image gallery extension
ronniestamps
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 27 Nov 2010, 03:43

Swap - swap main image AND thumbnail Will Pay

Post by ronniestamps »

Using the swap image setting, I've styled the gallery like this: http://stilifecreative.com/index.php?op ... id=4:print

I would like all thumbnails to be a gray box using either an image I have created or css #CCCCCC until you hover over it and it reveals the actual thumbnail and stays that way unless the page is reloaded or revisited... starting with all gray boxes again.

I've approached this using javascript and css with no luck. I have experience in both but am not an expert. I believe the issue that I am running into is that the thumbnails do not have a unique id that is generated within the image tags. I also think I may be over thinking this task. Any insight would be absolutely awesome.

Thank you in advance.

Joomla - 1.5.20
Phoca Gallery - 2.7.5
Last edited by ronniestamps on 07 Dec 2010, 04:21, edited 1 time in total.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49297
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Swap - swap main image AND thumbnail

Post by Jan »

Hi, no experiences, really no idea if this can be only by CSS, I think for this you need to use some javascript :idea:

Jan
If you find Phoca extensions useful, please support the project
ronniestamps
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 27 Nov 2010, 03:43

Re: Swap - swap main image AND thumbnail

Post by ronniestamps »

I'm 99% positive it CAN NOT be done with css, as the thumbnails are created by dumping an array into the jhtml image function. I am OK with using Javascript for this function. I've gotten really close, but need expert advice/help. My mention of css was only to show what I've tried so far.

Thank you for your input, any more would be greatly appreciated.

TIA - Ronnie
ronniestamps
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 27 Nov 2010, 03:43

Re: Swap - swap main image AND thumbnail

Post by ronniestamps »

@Jan - More than happy to make a more than minimum donation if you can solve this for me.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49297
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Swap - swap main image AND thumbnail

Post by Jan »

Hi, will be great but I have really no experiences with such feature and in fact I am not javascript expert :-( :idea: for me this is the same problem like for you :-(
If you find Phoca extensions useful, please support the project
ronniestamps
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 27 Nov 2010, 03:43

Re: Swap - swap main image AND thumbnail

Post by ronniestamps »

Anyone else? Willing to pay.
ronniestamps
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 27 Nov 2010, 03:43

Swap - swap main image AND thumbnail Will Pay

Post by ronniestamps »

Figured it out, will post code later.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49297
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Swap - swap main image AND thumbnail Will Pay

Post by Jan »

Ok
If you find Phoca extensions useful, please support the project
ronniestamps
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 27 Nov 2010, 03:43

Re: Swap - swap main image AND thumbnail Will Pay

Post by ronniestamps »

For swap image setting only. Should work in other situations but you would need to place the following code in different areas.

Open file components/com_phocagallery/views/category/tmpl/default.php

Each dynamically created thumbnail needs a unique name so the javascript knows which thumbnail is being hovered over. So...

declare a variable and assign it a value of 0:

Code: Select all

$imgids=0;
add your javascript to the code that generates the thumbnails:

Code: Select all

onMouseOut="document.a'.$imgids.'.src=\'http://stilifecreative.com/images/clear_thumb.gif\';"
so that the entire echo command looks like:

Code: Select all

echo ' onmouseover="PhocaGallerySwitchImage(\'PhocaGalleryobjectPicture\', \''. $switchImg.'\');displayDescription(\''.$value->description .'\');" onMouseOut="document.a'.$imgids.'.src=\'http://stilifecreative.com/images/clear_thumb.gif\';"';
this variable needs to auto-increment so add the following code on the line above the echo command you just modified:

Code: Select all

$imgids++;
Needs to be after

Code: Select all

else {
and before the echo command above.

add this line:

Code: Select all

echo '<img name="a'.$imgids.'" src="http://stilifecreative.com/images/grey_thumb.gif" class="pg-img-ovr1" />';
after this line:

Code: Select all

echo JHTML::_( 'image.site', $value->linkthumbnailpath, '', '', '', $value->altvalue);
fyi: clear_thumb.gif and grey_thumb.gif are the images I am using for the swap.

Hope this helps someone out in the future.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49297
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Swap - swap main image AND thumbnail Will Pay

Post by Jan »

Great, thank you for this guide.

Jan
If you find Phoca extensions useful, please support the project
Post Reply