This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

store img with tcl

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
Fire-Fox
Master
Posts: 299
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

store img with tcl

Post by Fire-Fox »

Hey!

Im trying to store img in my database (mysql)

How do i do that

it should store it from a url from my channel. And users should be able to request the img with a cmd.
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

If I understand you correctly, what you need to do, is to use the http package to retrieve the image data from the posted URL.

You'd then use the mysqltcl lib to insert the image data into a SQL table of your choosing.


As for "requesting" the image, once again use mysqltcl to extract the data from the table, and provide it to the user in whatever fashion you've intended (which is not specified in your post, by the way).

You should be aware that tcl is not really an efficient data handler, and might consider using a temporary file as intermediate storage for large files. You'd probably want to look at the -channel option for ::http::geturl, and use the LOAD_FILE() function with your INSERT SQL-query in this case.
NML_375
User avatar
Fire-Fox
Master
Posts: 299
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

Post by Fire-Fox »

Thanks i'll have a look at it, the db structure is in place. I just can figure out the code for it :(

EDIT: Would i could use something like this to store the img on the server, and maybe in the insert query do it so it insert the patch to the img in the db

http://forum.egghelp.org/viewtopic.php?p=99547#99547
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
Post Reply