Forum

> > CS2D > Scripts > lua Image from internet
Forums overviewCS2D overview Scripts overviewLog in to reply

English lua Image from internet

8 replies
To the start Previous 1 Next To the start

old lua Image from internet

Cebra
User On Online

Quote
Hey us,

Did somebody know, if i can use internet-path in the image function?
For example:
1
image ("www.for.de/example.bmp",100,100,2)

Atomic

old Re: lua Image from internet

GeoB99
Moderator Off Offline

Quote
From what I've heard it does not support URL image link paths, at least not the cs2d lua cmd image itself and it's not told in the image's info.

old Re: lua Image from internet

DC
Admin Off Offline

Quote
Not directly, but indirectly.
All images you want to use need to be in the sys/servertransfer.lst anyway and the sys/servertransfer.lst allows HTTP downloads.

sys/servertransfer.lst has written
// New since 0.1.1.8: HTTP Downloads
// You can also host your files on HTTP webservers instead of your game server.
// Use the following scheme to add HTTP file transfers:
// scheme: http://www.url.tld/myfile (web URL) > folder/file (local relative path)
// example: http://www.unrealsoftware.de/img/icons/cs2d.png > gfx/cs2dicon.png
//
// Warning: HTTP downloads might freeze the client for a few seconds if the webserver is slow!
// Warning: It is recommended to use lower case letters in file names and paths only


sys/servertransfer.lst with your example:
1
http://www.for.de/example.bmp > gfx/example.bmp

Lua cs2d lua cmd image call with your example:
1
image ("gfx/example.bmp",100,100,2)

• Of course you shouldn't use bmp then - use png or jpeg instead.
• It doesn't allow you to dynamically get any other images. All images have to be defined beforehand.
• This feature has not been heavily tested and might have some bugs... it has been requested by some people but I'm not sure if anyone is actually using it.

old Re: lua Image from internet

Hajt
User Off Offline

Quote
Yeah, it's possible.
1
os.execute("wget http://www.for.de/example.bmp -O /home/cs2d/gfx/example.bmp")

old Re: lua Image from internet

Cebra
User On Online

Quote
What does the -0 mean?
This script part must only in a hook and then it will donload it?
And can i delet pics which are downloaded by this command like in a ram or cache?

old Re: lua Image from internet

GeoB99
Moderator Off Offline

Quote
user Cebra has written
What does the -0 mean?

Is a sub-prefix/option of "wget" command on Linux. You'll get bit confused when you read the explanation of "-O" wrote below but I am sure you can figure it somehow.
man wget has written
The documents will not be written to the appropriate files, but all will be concatenated together and written to file. If - is used as file, documents will be printed to standard output, disabling link conversion. (Use ./- to print to a file literally named -.)

Use of -O is not intended to mean simply "use the name file instead of the one in the URL;" rather, it is analogous to shell redirection: wget -O file http://foo is intended to work like wget -O - http://foo > file; file will be truncated immediately, and all downloaded content will be written there.

For this reason, -N (for timestamp-checking) is not supported in combination with -O: since file is always newly created, it will always have a very new timestamp. A warning will be issued if this combination is used.

Similarly, using -r or -p with -O may not work as you expect: Wget won’t just download the first file to file and then download the rest to their normal names: all downloaded content will be placed in file. This was disabled in version 1.11, but has been reinstated (with a warning) in 1.11.2, as there are some cases where this behavior can actually have some use.

Note that a combination with -k is only permitted when downloading a single document, as in that case it will just convert all relative URIs to external ones; -k makes no sense for multiple URIs when they’re all being downloaded to a single file.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview