Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Need to display a user chosen image in a frameset

Posted on 2007-09-29
11
Medium Priority
?
549 Views
Last Modified: 2013-12-18
In an application I am dealing with which is Notes and web based I need to be able to display a photo chosen by the admins of the site on the front page.  Doesn't sound too difficult but I've been up a few dead-ends and would appreciate your thoughts.

Everyone has R7.  The app. has a front frameset for web and client (one each) which currently has various pages on there for navigation etc.  There is currently a form displayed in one frame which looks up news stories from a suitable view refreshing periodically to get the next news story.  Those are just looked up as plain text and formatted in the form.

I have split the frame up to give a place for the photo and have a set of forms where the users of the system can add an image to a rich text field in a document, give it a tag name in a text field and have a view they can be looked up in.  If the form is opened in read mode the photo will show as required.

So what I was going to do then was show the form in read mode in the frame.

Then the mental block came.

It would be so much easier if I just told them they'd have to get one of the Notes admins or designers to add an image resource to the database each month when it needs updating and link to that, or even give them more ACL rights but the rest of the system has been designed around them having Author access so don't want to do that.  I did toy with a second database just for the images and use the image resources from there... and give them designer ACL to that.

Anyway, any suggestions gratefully accepted.  Apologies if I don't reply right away, currently moving offices etc.

thanks

Steve
0
Comment
Question by:Steve Knight
  • 6
  • 4
11 Comments
 
LVL 63

Expert Comment

by:SysExpert
ID: 19985815
Can you load it from an external file ?

That may give sufficient flexibility, if they have access to the OS.

0
 
LVL 43

Author Comment

by:Steve Knight
ID: 19986608
Hi SysExpert, will have a think about that and come back to the Q tomorrow.... not sure how that helps at the mo.

Also toying with the idea of just using a URL link in the frame and putting the image on a web server they have access to or bakc within domino.

Anyway no time now, will look back tomorrow.

thanks
Steve
0
 
LVL 18

Accepted Solution

by:
marilyng earned 2000 total points
ID: 19987043
Hmm, can't find the question that dealt with this.  But, if your database allows people to attach a file, rather than embed it, then you have a handle on the image and can use that filename and document to display the image using a computed text (passthru HTML) url on the page or on a form in a frameset.

Here is one concatenation:
server := @If(@Subset(@DbName;1) = ""; "localhost"; @Subset(@DbName;1));
"<img src=\"http://" + server + "/" + @WebDbName + "/" + @Text(@DocumentUniqueID) + "/$File/" + @URLEncode( "Domino" ; @AttachmentNames) + "\"></img><br>"

Here is one that displays several attached images:
s1:="<img src=\"";
s2:="\">";
SERVER:=@If(@Subset(@DbName;1)="";"http://localhost/";"http://servername/");
DBName:=@ReplaceSubstring(@Subset(@DbName;-1);" ";"%20");
DEFAULTVIEW:="/3a458e1679d339bb85257135005aaa96/";
UNID:=@Text(@DocumentUniqueID) + "/";
IMG:="$FILE/" ;
TheLink:=SERVER + DBNAME + DEFAULTVIEW+ UNID + IMG;
Add1:=s1+theLink + @ReplaceSubstring(AttachmentNames;" ";"%20");
Add2:=Add1+s2;
@Implode(Add2;"<BR>")
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 43

Author Comment

by:Steve Knight
ID: 19988154
Thanks marilyng, that's a cunning plan.  Just had a play with something based on that and it seems to do the trick. I had been embedding he images in a rt lite field and toying with displaying the form through a URL Link to it but this is a much better idea, didn't know I could get a handle on an attachment in that way.

I suppose it would be cheeky to ask if you know how to scale it to fit the frame (in Notes and web) before I have a play with that!

thanks

Steve
0
 
LVL 18

Expert Comment

by:marilyng
ID: 19988476
If you know the frame dimensions, then you can add a bit of dimensions in the HTML tag:
<a href="example.gif"><img src="example.gif" alt="" width="50" height="75"></a>

It is, after all, building a standard html tag. :)
0
 
LVL 43

Author Comment

by:Steve Knight
ID: 19988961
Had tried that, unfortunately of course that doesn't help keep the aspect ratio right ... i.e. you can't do height=50 and leave it to sort out the width.

Anyway I think we have a workable solution here.  I'll play around with it today or tomorrow, post what I use, and close this off or ask more if I need to.

thanks for your help

Steve
0
 
LVL 43

Author Comment

by:Steve Knight
ID: 19989615
Well got that working to my liking now.  Have used code like this:

imagename:=@GetProfileField("Config";"Conf_FrontImage");
docid:=@DbLookup("":"";"";"Images";imagename;"docid");
server := @If(@Subset(@DbName;1) = ""; "localhost"; @Subset(@DbName;1));
filename:=@GetDocField(docid;"IM_AttachmentNames");
"<P align=center><img width=450 height=300 src=\"http://" + server + "/" + @WebDbName + "/" + @Text(docid) + "/$File/" + @URLEncode( "Domino" ; filename) + "\"></img></P><br>"

Where the user chooses imports an image into a rtlite field in a form called Image in a view called Images.  They choose an image from the view which sets a field in an existing profile document called Conf_FrontImage.

The profile field is looked up and used to get the docid of the document holding the image.  The attachment names are stored in a computed text field in this document "IM_AttachmentNames" which is checked in the document to make sure only one attachment has been added and that it ends in jpg.

The code above is computed text on a page where the image is added at a fixed size in 3:2 aspect ratio to fit a frame on the front page of the system....

Many thanks for the pointers!

Steve
0
 
LVL 18

Expert Comment

by:marilyng
ID: 19995301
So, if you used the width=450 without the Height, it doesn't size the image proportionally?
0
 
LVL 43

Author Comment

by:Steve Knight
ID: 19995324
Nope, you get 450 wide and, say, 200 or 2000 high.... whatever is the original size..stretchy vision.  Have just informed them and through info. on the forms that the aspect has to be 3:2 and all should be fine...
0
 
LVL 18

Expert Comment

by:marilyng
ID: 19995378
I'll have to find my snippet that gets the current img properties so they can be resized, it was a javascript thing, but I don't recall it offhand.
0
 
LVL 43

Author Comment

by:Steve Knight
ID: 19996945
Well if you find it that'll be great for future but don't worry too much, for what's needed here what I have is enough!  I've seen a few javascript resize scripts having googled so I guess it's not that hard - LotusScript and formula I'm fine but Java and JavaScript I just dabble with bits of validation etc. really.

thanks for your help earlier.

Steve
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month20 days, 23 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question