Link to home
Create AccountLog in
Avatar of Steve Knight
Steve KnightFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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
Avatar of SysExpert
SysExpert
Flag of Israel image

Can you load it from an external file ?

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

Avatar of Steve Knight

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of marilyng
marilyng

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
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
Avatar of marilyng
marilyng

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. :)
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
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
So, if you used the width=450 without the Height, it doesn't size the image proportionally?
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...
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.
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