Larger Image in Popup?

Shadow_Wolf
Shadow_Wolf's picture

Joined: 2004-04-03
Posts: 181
Posted: Thu, 2005-03-10 05:37

I have done a search in G2 area and haven't really found a modification or method to do this with G2. With G1 I am able to have basically 3 image sizes that I use thumbnail, intermediate (usually displayed within page), then the original full size image if over a certain size which appears in a popup.

My website has certain size restraints so that it doesn't go over a certain width. For example we'll say its setup to only show up as a 800 pixels wide page. I can set the image size to only go to 640 width so it preserves the layout. I have artists that either create larger resoultion wallpaper or items that go over the 640. Now if I allow them to go over that size it will distort the website. If I set a size restriction then I defeat the purpose for some of the artists and sections in my sight. This was solved by having the larger image appear in a popup. I don't currently see a method to do this, is this possible to do?

----

Gallery URL (optional): http://www.protoculturex.com/test/gallery2
Gallery version: 2.0-beta-1
Webserver (with version): Apache 1.3.33
Datatabase (with version): MySQL - 4.0.22-standard
PHP version (eg 4.2.1): 4.3.10
Operating system: Linux
Web browser/version: Firefox 1.0.1

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Thu, 2005-03-10 13:16

you can make a local template for layouts/matrix/templates/singleBody.tpl that does this.

 
Shadow_Wolf
Shadow_Wolf's picture

Joined: 2004-04-03
Posts: 181
Posted: Thu, 2005-03-10 15:07

Ok so I downloaded and duplicated /templates/singleBody.tpl. According to the instructions at the top I create and directory called local, upload the edited file to there.

Since there is a full image link already, I believe I would need to edit the full size part but I'm not sure what I would need to modify it to get to popup into a seperate window.

              {if !empty($layout.sourceImage)}
              <li>
                {g->text text="Full size: "}
                {capture name="fullSize"}
                {if empty($layout.sourceImage.width)}
                {$layout.sourceImage.itemTypeName.0}
                {else}
                {g->text text="%dx%d" arg1=$layout.sourceImage.width arg2=$layout.sourceImage.height}
                {/if}
                {/capture}
                {if count($layout.imageViews) > 1}
                <a href="{g->url arg1="view=core:ShowItem" arg2="itemId=`$layout.item.id`" arg3="imageViewsIndex=`$layout.sourceImageViewIndex`"}">{$smarty.capture.fullSize}</a>
                {else}
                {$smarty.capture.fullSize}
                {/if}
              </li>
              {/if}

If I wanted to make the image a link to where it would popup with the full image, I suppose I would take the popup image code and replace or edit the link parts here:

    <div class="gsSingleImage">
      {if !empty($layout.imageViews)}
      {capture name="fallback"}
      <a href="{g->url arg1="view=core:DownloadItem" arg2="itemId=`$layout.item.id`"}">
        {g->text text="Download this %s" arg1=`$layout.sourceImage.itemTypeName.1`} 
      </a>
      {/capture}

      {if ($layout.can.viewInline[$layout.imageViewsIndex])}
	{if isset($layout.photoFrame)}
	  {g->block type="imageframe" frame=$layout.photoFrame}
	    {g->image item=$layout.item image=$image id="%ID%" class="%CLASS%"}
	  {/g->block}
	{else}
	  {g->image item=$layout.item image=$image fallback=$smarty.capture.fallback}
	{/if}
      {else}
	{$smarty.capture.fallback}
      {/if}
      {else}
	{g->text text="There is nothing to view for this item."}
      {/if}
    </div>
 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Thu, 2005-03-10 19:22

in your first snippet above you can see how it contructs the <a> for the full size image link.. just put that same <a>..</a> around the {g->image} that shows the actual image, and add a target=".." in the <a> so it uses a new window..
if you want the popup to have literally just the fullsize image and not the G2 page that shows the fullsize image, just change core:ShowItem to core:DownloadItem in the {g->url} and remove arg3.

 
Shadow_Wolf
Shadow_Wolf's picture

Joined: 2004-04-03
Posts: 181
Posted: Thu, 2005-03-10 19:55

Ok I think I understand that now, makes a sense that it almost seems to simple. As I become more familar to the layout of things I'm sure I'll get a better handle on things. Thank you, I'll try it and test it out when I get home from work and get some time and let you know if there are any problems. But seems straight forward.

 
Shadow_Wolf
Shadow_Wolf's picture

Joined: 2004-04-03
Posts: 181
Posted: Fri, 2005-03-11 01:10

Hhmmm ok I had it working. Then when I tried to remove the 1024 size from the drop down it stopped working. For some reason though I can still click on the Full size: 1024x768 which will at least open the full size image into a popup.

http://www.protoculturex.com/test/gallery2/main.php/v/sinaj/1024/paraevelrg.jpg.html?g2_imageViewsIndex=0

I just want it to show the full size and not have the drop down with the two sizes. Or the user can just click on the image to open it up to full size. I tried editing the album and removing the second size of 1024x768 but that didn't seem to have any effect.

For Full size: 1024x768 I'm using:

<a href="{g->url arg1="view=core:DownloadItem" arg2="itemId=`$layout.item.id`"}" target="_blank">{$smarty.capture.fullSize}</a>

To try to get the image to be able to click and create popup to original image size I tried the same thing but it worked once and now isn't:

<a href="{g->url arg1="view=core:DownloadItem" arg2="itemId=`$layout.item.id`"}" target="_blank">
{g->image item=$layout.item image=$image fallback=$smarty.capture.fallback}</a>
 
toinen34

Joined: 2004-12-20
Posts: 4
Posted: Wed, 2005-04-20 18:55

Shadow Wolf, did you get it working??

If you did, could you please post the /singlebody.tpl, I'm still having trouble with it.

Cheers

 
lvthunder

Joined: 2003-09-12
Posts: 808
Posted: Wed, 2005-04-20 19:39

Do you want the drop down menu at all? In my layout I took it out. I made it where you click on the image to get the full size and if your looking at the full size you click on it to go back to the medium size.

 
toinen34

Joined: 2004-12-20
Posts: 4
Posted: Fri, 2005-04-22 10:23

I don't want to use the drop down menus at all.

What I'm trying to do is this. Clicking on the thumbnail opens the mid-size picture and by clicking on the mid-size picture the fullsize picture will open in a popup window.

 
Jhearad

Joined: 2005-02-11
Posts: 10
Posted: Sun, 2005-05-15 16:36

Any luck getting this to work, I am looking for a similar solution but have yet to find it.

 
Shadow_Wolf
Shadow_Wolf's picture

Joined: 2004-04-03
Posts: 181
Posted: Sun, 2005-08-07 15:25

Now that we aren't using layouts anymore where would I make this edit now?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sun, 2005-08-07 15:31

In your theme ;). The changes should be similar. But change any references of layout to theme.

 
Shadow_Wolf
Shadow_Wolf's picture

Joined: 2004-04-03
Posts: 181
Posted: Sun, 2005-08-07 16:21

Except I don't have a singleBody.tpl, so would it be photo.tpl?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sun, 2005-08-07 16:40

Yes. And albumBody.tpl would be album.tpl. You can also have more control with theme.tpl now too.

You may also want to check out this thread, http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&p=157799#157799

However, the changes I made are no longer on my site...

 
Shadow_Wolf
Shadow_Wolf's picture

Joined: 2004-04-03
Posts: 181
Posted: Sun, 2005-08-07 18:14

When modifying them do they go into /themes/matrix/local or /themes/matrix/templates/local?

I have looked in album.tpl and photo.tpl and I am not sure what creates the link for Full Size and the drop down menu. In album.tpl I have found this which seems to deal with the thumbnail parts but I am not sure:

{if isset($theme.params.$frameType) && isset($child.thumbnail)}
		    {g->container type="imageframe.ImageFrame" frame=$theme.params.$frameType}
		      <a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}">
			{g->image id="%ID%" item=$child image=$child.thumbnail
			 class="%CLASS% giThumbnail"}
		      </a>
		    {/g->container}
                  {elseif isset($child.thumbnail)}
		    <a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}">
		      {g->image item=$child image=$child.thumbnail class="giThumbnail"}
		    </a>
                  {else}
		    <a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}"
                       class="giMissingThumbnail">
		      {g->text text="no thumbnail"}
		    </a>
                  {/if}

Just to test out I try changing the ShowItems to DownloadItem refreshed and cleared cache but they didn't appear to change anything, so it looks like I am on the wrong path but those seem to be the only places where links are created that I can see.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sun, 2005-08-07 18:46

/themes/matrix/templates/local as far as I know.

I'd have to search or ask about the rest. I'm not sure what needs to be done to get the fullsize image, though I could've sworn changing core.ShowItem to core.DownloadItem would get that result.

 
Shadow_Wolf
Shadow_Wolf's picture

Joined: 2004-04-03
Posts: 181
Posted: Wed, 2005-09-07 02:23

Ok I am having trouble still trying to find the links that create the full size image link. If I am looking at this page here:
http://www.protoculturex.com/index.php?ind=artgallery&g2_view=core.ShowItem&g2_itemId=320
Would that be using photo.tpl? If I want that to become the full size image then I will have to add something like this to where it creates the link:<A href="javascript:void(0);" onclick="window.open('{g->url arg1="view=core.DownloadItem" arg2="itemId=`$theme.item.id`"}','viewWindow', '{g->text text="width=%d,height=%d" arg1=$theme.sourceImage.width+20 arg2=$theme.sourceImage.height+20}, resizable=yes,scrollbars=yes' );">
I am not sure where the Full Size link is at as well, I would think it is also in photo.tpl since it doesn't show in album but I am not sure which one. The link is actually showitem but all I see in the .tpl is downloaditem. I did try replacing the two places where I see this, with the above code but it didn't work.<a href="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$theme.item.id`"}">

 
lvthunder

Joined: 2003-09-12
Posts: 808
Posted: Wed, 2005-09-07 02:59

It is my understanding that the core.DownloadItem is for a link to download objects that don't have a picture to show. The link for the full size image is in gallery2/modules/core/templates/blocks/PhotoSizes.tpl.

 
Shadow_Wolf
Shadow_Wolf's picture

Joined: 2004-04-03
Posts: 181
Posted: Wed, 2005-09-07 03:15

Ok no wonder I couldn't find the full size image link. Thank you. I have that fixed so at least when they click on the Full Size part it opens it in a pop-up window. I found what I needed to modify in photo.tpl too. It looks like the image is displayed using:

{g->image id="%ID%" item=$theme.item image=$image fallback=$smarty.capture.fallback class="%CLASS%"}

and

{g->image item=$theme.item image=$image fallback=$smarty.capture.fallback}

I just replaced thm with:

      <A href="javascript:void(0);" onclick="window.open('{g->url arg1="view=core.DownloadItem" arg2="itemId=`$theme.item.id`"}','viewWindow', '{g->text text="width=%d,height=%d" arg1=$theme.sourceImage.width+20 arg2=$theme.sourceImage.height+20}, resizable=yes,scrollbars=yes' );">
          	{g->image id="%ID%" item=$theme.item image=$image fallback=$smarty.capture.fallback class="%CLASS%"}
   </a>

and 

      <A href="javascript:void(0);" onclick="window.open('{g->url arg1="view=core.DownloadItem" arg2="itemId=`$theme.item.id`"}','viewWindow', '{g->text text="width=%d,height=%d" arg1=$theme.sourceImage.width+20 arg2=$theme.sourceImage.height+20}, resizable=yes,scrollbars=yes' );">
         {g->image item=$theme.item image=$image fallback=$smarty.capture.fallback}
   </a>

Anyone see any issues with the code? So far it has been working fine but it was strictly guesses and trial and error on my part.

 
alexprime

Joined: 2005-11-01
Posts: 3
Posted: Tue, 2005-11-01 20:53

How did you get the code to work? I replaced it exactly as you said but it actually has no effect when I do it.

 
mambocreed

Joined: 2005-08-26
Posts: 19
Posted: Sat, 2005-11-05 04:46

Ditto on that :) How did you get that to work exactly?
I've got the same problem, larger images breaking the layout.

 
Phlogiston

Joined: 2005-11-06
Posts: 1
Posted: Sun, 2005-11-06 15:50

same here, could anyone sum up this and tell me how to do it? Thanks a lot

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Mon, 2005-11-07 07:55

alexprime, try clearing your template cache. If that doesn't work, can you post a link to your site?

mambocreed, What do you mean "larger images breaking the layout"? Can you post a link to your site?

Phlogiston, what's your problem? My ability to read minds does not reach through the internet :) "it's broken" doesn't get much help other than "fix it" :)
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
doncmdr

Joined: 2006-01-05
Posts: 5
Posted: Thu, 2006-01-05 01:24

I tried the modifications on the photo.tpl today and it works quite well.
But there are two things i'd like to change.
First the behaviour of the popup window. If you don't close the popup but click it to the background it doesn't come back in front if you try to view another picture. This is a little bit irritating, one could think that the link didn't work.
I would like the popup to come back in front if you click on a picture.
And Second:
If you don't click on the picture but choose the fullsize view from the menu, the picture is opened in the same browser window.
Also in this case I would like the picture to open in the popup.

Is somebody able to help me with this modifications?
tnx,
Jörg

 
dotnature
dotnature's picture

Joined: 2005-10-26
Posts: 224
Posted: Fri, 2006-01-27 22:55

Just to add to this thread since its referanced a lot and to clear up some confusion I went through trying to get this to work since
I have an embeded site and full size breaks the layout.
First let me say that I customized my site, I deleted the dropdown box ( I find 2 sizes are enough normal and full size),
the full size link does not open in a new window it opens in the current window alone ( that way you can just hit back button and also allow user to shift or right click and open it new window)
And finally I added a javascipt under the image for it to open in a new window.

To change the dropdown and full size I edited... modules/core/templates/blocks/photosizes.tpl

I changed

Quote:
a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$theme.item.id`"

to

a href="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$theme.item.id`"

This just opens the image alone in current window, you can add more here to do what you want really under Size and Fullsize, I deleted the Size parts.

For the javascript window full size pop-up which text displays under the photo I added this to my themes templates/photo.tpl

Quote:
Under {* Download link for item in original format *} insert this

{if count($theme.imageViews) > 1} {if !empty($theme.sourceImage)}
<p class="gbIBlock">
<A href="javascript:void(0);" onclick="window.open('{g->url arg1="view=core.DownloadItem" arg2="itemId=`$theme.item.id`"}','viewWindow', '{g->text text="width=%d,height=%d" arg1=$theme.sourceImage.width+20 arg2=$theme.sourceImage.height+20}, resizable=yes,scrollbars=yes' );">
{g->text text="View Full Picture"} {if !empty($theme.sourceImage.width)}
({g->text text="%dx%d" arg1=$theme.sourceImage.width arg2=$theme.sourceImage.height})
({g->text text="Javascript New Window"})
{/if}
</a>
</p>
{/if}
{/if}

hope this helps as it wasnt exactly clear that you had to edit photosizes.tpl

 
antisa33

Joined: 2006-06-26
Posts: 30
Posted: Tue, 2006-07-11 12:54

I am interested to open my larger picture in a popup and to add a print button, do you have any ideas ?
Thanks

 
doncmdr

Joined: 2006-01-05
Posts: 5
Posted: Thu, 2006-08-03 11:00

I just updated to Gallery 2.1 and it seems the modifications on the photo.tpl are no longer working.
Before the update everything worked fine, now the popup windows shows up but instead of the picture an errormesseage ist shown:
Error (ERROR_MISSING_OBJECT) : Missing object for 0

* in modules/core/classes/GalleryStorage/GalleryStorageExtras.class at line 1852 (gallerycoreapi::error)
* in modules/core/classes/GalleryStorage/GalleryStorageExtras.class at line 109 (gallerystorageextras::_identifyentities)
* in modules/core/classes/GalleryStorage.class at line 293 (gallerystorageextras::loadentities)
* in modules/core/classes/helpers/GalleryEntityHelper_simple.class at line 82 (mysqlstorage::loadentities)
* in modules/core/classes/GalleryCoreApi.class at line 2382 (galleryentityhelper_simple::loadentitiesbyid)
* in modules/core/DownloadItem.inc at line 71 (gallerycoreapi::loadentitiesbyid)
* in main.php at line 378 (downloaditemview::renderimmediate)
* in main.php at line 87
* in main.php at line 80
* in /var/www/joerg/gallery2/main.php at line 3

Can anyone help?
Jörg

 
vcorreia

Joined: 2006-08-08
Posts: 4
Posted: Wed, 2006-08-09 00:57

there is a much easier solution. I wasted 3 hours to solve my problem. It is the same as the author of this topic (to display full size photo in new window). The problem was to find where the full size link was defined...the rest is very easy, and because of that, it works all the time.

If u want to delete the dropdown, go to gallery2\modules\core\templates\blocks\PhotoSizes.tpl
delete the following:

{if count($theme.imageViews) > 1}
     {g->text text="Size: "}
     <select onchange="{literal}if (this.value) { newLocation = this.value; this.options[0].selected = true; location.href= newLocation; }{/literal}">
     {section name=imageView loop=$theme.imageViews}
       <option value="{g->url arg1="view=core.ShowItem" arg2="itemId=`$theme.item.id`"
	arg3="imageViewsIndex=`$smarty.section.imageView.index`"}"{if
	$smarty.section.imageView.index==$theme.imageViewsIndex} selected="selected"{/if}>
	 {if empty($theme.imageViews[imageView].width)}
	   {if isset($theme.imageViews[imageView].isSource)}
	     {g->text text="Source"}
	   {else}
	     {g->text text="Unknown"}
	   {/if}
	 {else}
	   {g->text text="%dx%d" arg1=$theme.imageViews[imageView].width
	       arg2=$theme.imageViews[imageView].height}
	 {/if}
       </option>
     {/section}
     </select>
     <br/>
   {/if}

It is easy to see here the dropcode finishes and the FULL SIZE LINK code starts.

Now, for the best part, to display the full size photo (original size) in a new browser window, just look for

 <a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$theme.item.id`"
	arg3="imageViewsIndex=`$theme.sourceImageViewIndex`"}">

in the next few lines of code, and change to this:

 <a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$theme.item.id`"
	arg3="imageViewsIndex=`$theme.sourceImageViewIndex`"}" target="_blank">

i just added the simple html tag, "target="_blank".

 
doncmdr

Joined: 2006-01-05
Posts: 5
Posted: Wed, 2006-08-09 22:52

I'm not sure if this works in a Multisite installation.
I assume the File PhotoSizes.tpl is used by every instance of an Multisite install, but I want to change this behavior just for one instance.
Is this possible?