Help to Change CodeStore Code for Image in a View

Hi,

I am trying to get an image from each document to display in a view.

I have got it to work using the code below from Jake at CodeStore:

“<img src="” + @Text(@DocumentUniqueID) + “/$file/” + @AttachmentNames + “" alt="img" />”

Problem is I want it to display the image from a certain field only (fieldname = “Img1”) and not all image file attachments on the document like this code is doing.

Can someone give me a hand please, is this just an easy code change or is it more difficult?

Many thanks,

Matt.

Subject: Help to Change CodeStore Code for Image in a View

why not have a hidden field on the document that stores the computed URL?

You could use the querysave event to run some lotusscript which would build the URL by getting the embedded objects and checking the parent property to see the name of the field that contains the image.

This will also mean the view column can simply reference a field instead of having to compute a value which should improve the performance of the view.

Subject: RE: Help to Change CodeStore Code for Image in a View

Hi Chris,

Thanks for your response, I understand what you are saying but I do not know Lotus Script very well and am a “Learning Developer.”

Is it possible to just tell the view to look in a field to get the image file? I guess not as it is HTML huh?

Any help much appreciated.

Matt.

Subject: RE: Help to Change CodeStore Code for Image in a View

Attachments are not held “in” the rich text fields where the link appears; they are held in $File items on the document. That’s why the URL goes through “/$File/”. All of these items have the same name (a possibility in Rich Text fields).

Subject: RE: Help to Change CodeStore Code for Image in a View

OK, Can I specify the image by name then?

I can then make sure that the image is the same name in all documents, meaning the image will be shown in the view, but any others attached to the document will not.

Many thanks,

Matt.

Subject: RE: Help to Change CodeStore Code for Image in a View

Matt, maybe it would be usefull if you could briefly explain what your trying to achieve. What is the purpose of the icon?

If it is to show a graphical icon for a document status for example then you have a few options.

  1. You can simply reference an exiting domino icon

  2. You can attach a custom image in the databases resources and then use a computed value/dialog list to pick the image

  3. You can store the images in individual documents and get the image using the method you have used but computing the path to the “image” document.

Subject: RE: Help to Change CodeStore Code for Image in a View

Chris,

Thanks for responding again.

Each document contains an image attachment. Each document is a property which is for sale.

Therefore, in the web view, I want that image to be displayed, therefore having a small picture of each property in each row in the view, together with other details like type, number of bedrooms, etc so web users can see the small picture and click on it, which will take them into the actual document.

At the moment, I am using the code I said, which looks at any attachments on the document and puts them in the view. I am therefore only attaching one image per document to get this to work. I want to start attaching other larger images to use for other things, but if I attach any other files onto the document, they display in the view too.

Hence my thought of calling the image file that shows up in the view a certain within each document - like view_image.gif. Would that work with the code I am using??

If so, what would I have to do to the code. Sorry, a newbie to this but learning fast now.

Many thanks,

Matt.

Subject: RE: Help to Change CodeStore Code for Image in a View

It sure will. In fact, you can do the same sort of thing with all of the attachments – give them a consistent name across all documents, then coding any links (to, say, PDFs and so forth) can be done the same way.

Subject: RE: Help to Change CodeStore Code for Image in a View

Thanks to all who helped me here.

Sorry, but I am a newbie in at the deep end, learning fast.

We have all been there and thanks for taking the time to help me.

All sorted now, still not 100% sure how that formula is working, but I reapaced the @attachmentnames with the file name viewimage.gif and it is picking the image with that name, meaning I am able to attach other files into the document without them diplaying in my view.

Cheers,

Matt.