Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1287
  • Last Modified:

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

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
0
Jean Marie Geeraerts
Asked:
Jean Marie Geeraerts
  • 10
  • 7
  • 3
  • +2
2 Solutions
 
Sjef BosmanGroupware ConsultantCommented:
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!
0
 
Jean Marie GeeraertsAuthor 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!
0
 
HemanthaKumarCommented:
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
0
Technology Partners: 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!

 
Sjef BosmanGroupware ConsultantCommented:
jerrith,

You could of course open each file, read line by line, and replace all links by new ones. I think we did this once, a long, long time ago. Worked for us. You have to walk through the HTML anyway, don't you?

Then you could choose to import every image in a separate Picture document, to be found in the Pictures-view, to be referenced as db.nsf/pictures/picname.gif/$File/picname.gif

Sjef
0
 
Jean Marie GeeraertsAuthor 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.
0
 
Sjef BosmanGroupware ConsultantCommented:
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...
0
 
Jean Marie GeeraertsAuthor Commented:
You are right, Sjef.
Does the image resource have a limit as to the maximum number of images?
0
 
Jean Marie GeeraertsAuthor 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 :-)
0
 
Sjef BosmanGroupware ConsultantCommented:
It's the "pragmatic" way (I used to hate that word!)
0
 
Jean Marie GeeraertsAuthor 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.
0
 
Sjef BosmanGroupware ConsultantCommented:
And a day is 24 hours? Piece of cake ;)
0
 
Jean Marie GeeraertsAuthor Commented:
Hemanth, I'll look into the suggested links tomorrow. Thanks.

Sjef, no just 7.5 hours in a day here :-)
0
 
p_parthaCommented:
Hi jerrith,
There are couple of ways to handle this, but the basic question that sjef already raised  why do u require it to be a part of image resource?, It can be a part of a document,

and also the XML tookit guide has provisions (the <imageresource> element). The full working (free) practical example is in codestore.. Have a look at it.

http://www.codestore.net/store.nsf/unid/EPSD-54VLYL?OpenDocument


Partha
0
 
Sjef BosmanGroupware ConsultantCommented:
Jupiter has days of 9.84 hours...
0
 
p_parthaCommented:
Sjef,
I want to work in jupiter then..

Partha
0
 
Jean Marie GeeraertsAuthor 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 :)
0
 
Sjef BosmanGroupware ConsultantCommented:
Partha,

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

Sjef :)
0
 
Jean Marie GeeraertsAuthor 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 :-)
0
 
qwaleteeCommented:
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.
0
 
p_parthaCommented:
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
0
 
Jean Marie GeeraertsAuthor 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 :-)
0
 
Jean Marie GeeraertsAuthor 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!!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 10
  • 7
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now