We help IT Professionals succeed at work.

How to import files directly into image resources from a file server using LotusScript or LS2API...

Jean Marie Geeraerts
on
1,370 Views
Last Modified: 2013-12-18
Hello Guys,

Here I am again.
I can only spend two days development on the project I'm working on, so i'll need your help to get the job done quickly.

The requirement is to import a whole HTML web site into a notes database with all HTML HREF tags staying what they are.

The html files pose no problem, this is just a question of importing them as plain text into a document with form property "treat document contents as HTML" and then reference them from a sorted view that mimics the directory where they are in.

Things are a bit more complicated for images and .svg files and the sort.
These I'd like to import as an image resource in the database with as image resource name the full path of the imported image.

Does anyone know how this can be done using LotusScript or LS2API?

I am working with R5.0.12 and an upgrade to R6.x is out of the question. Third party products are probably out of the question too as the budget for the project is very limited.

Any help and suggestions are welcome!

Kind regards,

JM
Comment
Watch Question

Sjef BosmanGroupware Consultant
CERTIFIED EXPERT

Commented:
Q&D solution: Dump all images etc. in one document, so you'd have db.nsf/view/doc/$File as a BASE
You can also use the images-directory as mentioned in the website-document in the NAB.

Do something like this anyway, if you have only 2 days...

Success!
Jean Marie GeeraertsApplication Engineer

Author

Commented:
I'm pretty quick as it comes to writing code once I know where to start.
In theory it shouldn't be too complicated to write this. In fact I think Lotus should have provided the possiblity to do this with script!
The problem with the BASE solution is that I would have to modify all the imported html documents in a pretty smart way as I import the complete code from <html> to </html> and manipulating text isn't that straight-forward in script either in R5.

I'll just see what other hints come in and see.

Thanks for the tip so far!
Download this dll which can facilitate the import/export of image in IR

http://www.atom5.com/Development/IDEs-Coding-Utilities/image-resource-manager-5096.html

~Hemanth
Sjef BosmanGroupware Consultant
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Jean Marie GeeraertsApplication Engineer

Author

Commented:
Hm, this will only link to the page to buy the full version.
Is it possible to download a trial version somewhere? It does look very cheap and I suppose management would consider paying for this, but I'd have to test and see if I can use it first.
Sjef BosmanGroupware Consultant
CERTIFIED EXPERT

Commented:
Manipulating text is easy in LS: write your own Explode and Implode functions (don't call them like that, they do exist in R6 as Split and Implode). Pulling apart HTML the dirty way might not be the best way, but if the goal is to get the job finished in a short time...
Jean Marie GeeraertsApplication Engineer

Author

Commented:
You are right, Sjef.
Does the image resource have a limit as to the maximum number of images?
Jean Marie GeeraertsApplication Engineer

Author

Commented:
I already have StrImplode and strExplode functions that work exactly like @Implode and @Explode, so I could use those I guess.
The problem with me is I'm a bit of a perfectionist. I don't like Q&D solutions, even if I only have a limited time to write a solution :-)
Sjef BosmanGroupware Consultant
CERTIFIED EXPERT

Commented:
It's the "pragmatic" way (I used to hate that word!)
Jean Marie GeeraertsApplication Engineer

Author

Commented:
Still have a day left, so I'll wait and see for the moment. If I can't find 'the perfect way' by then I'll go with the Q&D you suggested.
Sjef BosmanGroupware Consultant
CERTIFIED EXPERT

Commented:
And a day is 24 hours? Piece of cake ;)
Jean Marie GeeraertsApplication Engineer

Author

Commented:
Hemanth, I'll look into the suggested links tomorrow. Thanks.

Sjef, no just 7.5 hours in a day here :-)
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Sjef BosmanGroupware Consultant
CERTIFIED EXPERT

Commented:
Jupiter has days of 9.84 hours...

Commented:
Sjef,
I want to work in jupiter then..

Partha
Jean Marie GeeraertsApplication Engineer

Author

Commented:
Looks interesting Partha. Unfortunately, doesn't look like I'll be able to implement this in the time frame give to me since I don't know anything about Java :(
Maybe in version 2.0 of the application when I've learned Java :)
Sjef BosmanGroupware Consultant
CERTIFIED EXPERT

Commented:
Partha,

They seem to have vacancies there. If you can cope with the pressure...
Better stay in the States.

Sjef :)
Jean Marie GeeraertsApplication Engineer

Author

Commented:
Pressure at work? Me? Naah, only problem is this is something I have to do "in between projects" and there's no budget for it, so I have to limit my time I spend on it to a maximum of two days, that's all :-)

Commented:
Assuming you had an images directory on the old server, so the files were referenced as <IMG SRC="/images/xyz.gif"> -- then you are almost home free!

1) Import multiple iamges at once into the database -- open the images screen in Designer, click NEW IMAGE RESOURCE, and select ALL the images.  Click OPEN, sit back, and wait.  Go get some coffee if there are many!

2) Define an HTTP redirect for the server -- /images/* -> /yourpath/yourdb.nsf/*
This will cause the server to redirect the browser to the correct image reosurce URL.  I think if you specify this as internal redirection, then there is almost NO penalty for doing it this way.

Commented:
Jerrith,
I believe sjef was talking abt the pressure in jupiter :)..

I second qwal's idea, just to add to it, u can just use DOM and get all the images and change their src , which is fast and efficient


Partha
Jean Marie GeeraertsApplication Engineer

Author

Commented:
Hello qwalatee,

Import needs to be automated through an agent that runs on a daily basis, so doing it manual isn't an option. (I did this once, just to demonstrate the possibility of using the image resources for images).
The redirection is not necessary if I use as name for the image resource "images/image.jpg" for example.

Anyway, it looks like a colleague of mine has some C code lying around somewhere I could use, but he's not coming back until next week.

So this is definitely to be continued later :-)
Jean Marie GeeraertsApplication Engineer

Author

Commented:
Hello guys,
Time to close up this question. The C code from my colleague was apparantly relying on some third party .dll's and management didn't like that either, so I decided to go with Sjef's bypass solution and import the images as file attachments and then change the URL reference to the file while importing the HTML files.
Thanks for all your input, guys!!
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.