Need to display a user chosen image in a frameset

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
LVL 44
Steve KnightIT ConsultancyAsked:
Who is Participating?
 
marilyngCommented:
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
 
SysExpertCommented:
Can you load it from an external file ?

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

0
 
Steve KnightIT ConsultancyAuthor Commented:
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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Steve KnightIT ConsultancyAuthor Commented:
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
 
marilyngCommented:
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
 
Steve KnightIT ConsultancyAuthor Commented:
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
 
Steve KnightIT ConsultancyAuthor Commented:
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
 
marilyngCommented:
So, if you used the width=450 without the Height, it doesn't size the image proportionally?
0
 
Steve KnightIT ConsultancyAuthor Commented:
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
 
marilyngCommented:
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
 
Steve KnightIT ConsultancyAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.