HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


How to add this link to large image?

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#73095 (In Topic #15313)
Avatar

Community saint

Okay, this is the last of the functional issues I have before I can turn my attention to theming.

On my image gallery catalog, I need to add a link to open a new window with the full-size image as shown below:


The image name will be the same except that the large image will be in /uploads/catalogues/large/ instead of /uploads/catalogues/. How can I build this link dynamically?

I think I need to place this code in CATALOGUE_image_galleries_ENTRY.tpl as shown below:

Code

<div class="float_surrounder">
   <div class="float_surrounder">
      <div style="width:150px; float:left;">
      {FIELD_1}<br />
      {FIELD_2}<br />
      {FIELD_3}<br />
      {FIELD_4}<br />
      <br /><br /><br />
      ***** Insert my link code here *****
      </div>
      <div style="width:75%; float:right;">
      {FIELD_5}
      </div>
   </div><br /><br />
   <div style="clear:both;"</div>
   <div style="width:100%;">
   {FIELD_6}
   </div>

</div>

Any of you coding gurus have any tips to get me started?

Thanks for any help.

Bob
Back to the top
 
Posted
Rating:
#73104
Avatar

Community saint

You can use $REPLACE to make the change dynamically.

For example, if the URL was in {FIELD_5}, you could replace {FIELD_5} with:

Code

{$REPLACE,/catalogues/,/catalogues/large/,{FIELD_5}}



Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#73105
Avatar

Community saint

Thanks, temp.

So I would use a Comcode url tag and do the replacement to the param portion?

Thanks for your help.

Bob
Back to the top
 
Posted
Rating:
#73106
Avatar

Community saint

I tried this but it displays the code along with a second version on the image rather than just a link:


This is the code that I tried:

Code

[url="View large image" target="_blank"]{$REPLACE,/catalogues/,/catalogues/large/,{FIELD_5}}[/url][title]Title[/title]

I clearly have done something wrong.

Any thoughts?

Bob
Back to the top
 
Posted
Rating:
#73108
Avatar

Community saint

Ok, so {FIELD_5} is returning a html fragment.

Try {FIELD_5_THUMB} or {FIELD_5_PLAIN}.

I've seen code references to this type of structure, but I can't find any documentation on it

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#73109
Avatar

Community saint

{FIELD_5_THUMB} just returned the thumbnail image instead of the larger image above.

{FIELD_5_PLAIN} seems like it should work but it is not creating the link though the link looks properly formed:


Any other ideas?

Bob
Back to the top
 
Posted
Rating:
#73110
Avatar

Community saint

The comcode is not evaluating, so you need to use {$COMCODE,..} tempcode.

The path to the image is not a URL, so need to prefix it with {$BASE_URL*}/ .

Put it all together, and this should do it:

Code

{$COMCODE,[url="View large image" target="_blank"]{$BASE_URL*}/{$REPLACE,/catalogues/,/catalogues/large/,{FIELD_5_PLAIN}}[/url][title]Title[/title]}

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#73112
Avatar

Community saint

You, sir, are a code wizard of the first order. And a damn fine teacher too. I feel like I learned quite a bit from this now if I can only remember it.

Thanks again.

Bob
Back to the top
 
Posted
Rating:
#73114
Avatar

Community saint

 :$

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#73138
Avatar

Community saint

BobS said

You, sir, are a code wizard of the first order. And a damn fine teacher too. I feel like I learned quite a bit from this now if I can only remember it.

Thanks again.

Bob

wot

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#73142
Avatar

Community saint

It's great that there are so many talented people who are willing to share their experience with ocPortal to help others. And this includes Chris and his crew, as well.

The community may not be large right now but with the kind of help given, I suspect it will be growing.

Bob
Back to the top
 
Posted
Rating:
#73223
Avatar

Community saint

I can tell you Bob, better a small comunity with great support than a big one with minimal support :)


http://digiflash.nl Photo community  (dutch)
Back to the top
 
Posted
Rating:
#73225
Avatar

Community saint

Agreed, Harry.

Bob
Back to the top
 
Posted
Rating:
#74894
Avatar

Community saint

Well, this works fine for me posting images as I will always post the large image.

However, for the regular member there is no corresponding image placed in /uploads/catalogues/large/. I need some way of fixing this.

Either I need to copy the original image into the /uploads/catalogues/large/ at submission which seems foolish since it will be the same size as the regular submitted image. So, what I would like is to use the image in /uploads/catalogues/ viewed full-size if there is no corresponding image in /uploads/catalogues/large/.

Anyone have any idea on how I might accomplish this? For reference, this is the current code in CATALOGUE_image_galleries_ENTRY.tpl:

Code

{$COMCODE,[url="View large image" target="_blank"]{$BASE_URL*}/{$REPLACE,/catalogues/,/catalogues/large/,{FIELD_6_PLAIN}}[/url]}

Any help is greatly appreciated.

Bob
Back to the top
 
Posted
Rating:
#74898
Avatar

Community saint

You have your logic backwards. You have to assume that all image uploads are large, and use thumbnails to down-scale where needed.

So instead of using the /uploads/catalogues/large/ custom folder for your large images you would be using a custom /uploads/catalogues/small/ folder for the thumbnails.

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#74902
Avatar

Community saint

Temp-

The code currently scales the images down on the page based on the thumbnail size. The images in are, in fact, larger. I set up the /uploads/catalogues/large/ folder for when I am scanning images and I want to provide an extra-large version (over 2k on the short dimension) which I populate vis FTP. The result is that the previous link works fine for any images that I upload.

However, when a regular member uploads his file  to /uploads/catalogues/, it is properly scaled down but there is no option to view the full-size image uploaded as is the case with my large images. That;s why I was thinking that if there is no image in /uploads/catalogues/large/, display the image in /uploads/catalogues/ in a new window at full-resolution which would mimic what happens with my large images.

I think I have that right.

Bob
Back to the top
 
Posted
Rating:
#74906
Avatar

Community saint

BobS said

However, when a regular member uploads his file  to /uploads/catalogues/, it is properly scaled down
Is it physically being scaled down (i.e. the original hi-res image is deleted/replaced), or are they only being presented with the smaller image. If it is just a presentation issue then the original hi-res image should still be accessible.

I had the same problem with galleries until I modified the template to present the thumbnail and provide a link to the original image.

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#74908
Avatar

Community saint

temp-

They are just presented with the scaled down image.

What I have been doing is copying their original uploaded images into /uploads/catalogues/large/, but that it not a practical solution as the site grows. That is why I'd like my link to present the image in /uploads/catalogues/large/ if it exists or otherwise present the unscaled original image.

In both cases, the larger image needs to open in its own window which is the way the current link now works. I need to figure out how to check if the large image exists and then choose the right image to display.

Bob

EDIT: They are physically being scaled down.

P.S. I wonder why I am not getting notifications for this thread. I see the "untracked topic" button so it seems it thinks I want notifications..



Last edit: by BobS
Back to the top
 
Posted
Rating:
#74909
Avatar

Community saint

I understand what you are doing but I don't understand why.

Why not just let all the images, including the large ones, be loaded to the default /uploads/catalogues/ and let the thumbnail be auto-generated. No manual moving required.

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#74910
Avatar

Community saint

Oh.  The reason I did that was because it was easier for me to upload the image at the same time I was creating the catalog entry but it stalled out with my really big images for whatever reason.

I gues I could just FTP the images into the directory and then specify them by URL. I could then change my link to just display the image in /uploads/catalogues. I think this is what you are suggesting.

Bob
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Expand