Page 1 of 1
Is it possible to write directly to a db?
Posted: 2014-03-15T01:58:33-07:00
by jack-mann
Code: Select all
convert large.png -crop 256x256 -set "filename:t" "%[fx:page.x/256]_%[fx:page.y/256]" +repage +adjoin PNG8:'.$workDir.'"/img_%[filename:t].png"
Can I somehow skip the writing to the filesytem and plug in to imagemagick and write directly to a database?
Re: Is it possible to write directly to a db?
Posted: 2014-03-15T06:33:16-07:00
by snibgo
If you have a command that takes an image and puts it into a database, then you could put that into delegates.xml. However, I don't see how you could specify which database, or how you would specify the key to the record you want to insert or update.
Re: Is it possible to write directly to a db?
Posted: 2014-03-15T08:36:14-07:00
by dlemstra
You should probably also read the following post:
http://stackoverflow.com/questions/3748 ... yea-or-nay. It has some great information about the pros and cons of storing images in a database.
Re: Is it possible to write directly to a db?
Posted: 2014-03-15T08:42:51-07:00
by jack-mann
thanks In my use case it does make sense since I am using SQLite and am transferring the db over the net...
Re: Is it possible to write directly to a db?
Posted: 2014-03-15T09:35:37-07:00
by fmw42
I think you may be able to do it with PHP as an intermediary. It can execute IM commands and also talk to SQL. But you still may have to create a physical file on disk.
Re: Is it possible to write directly to a db?
Posted: 2014-03-15T10:58:20-07:00
by jack-mann
that's what I am actually doing. I am calling convert from php. But since this is a server app with lots of io load it would be nice if I could save my script from generating those tmp files
Re: Is it possible to write directly to a db?
Posted: 2014-03-15T12:09:00-07:00
by fmw42
Ask you question on the developers forum and see if the IM developers can help.
But IM still will create tmp files to hold intermediate results from any complex command line. The only possible thing you might be able to save is the result, if the developers know of a way to write it directly to your database rather than the disk and subsequently copy it to database.
I really do not know.
Re: Is it possible to write directly to a db?
Posted: 2014-03-15T13:25:50-07:00
by jack-mann
I am afraid if I ask such a question on the dev forum the guys will make fun of me ....
I quess it is just not possible
Re: Is it possible to write directly to a db?
Posted: 2014-03-15T14:01:40-07:00
by magick
You cannot connect to a database, currently, from the command line. However, from a program you can call ImageToBlob() or ImagesToBlob() and write the blob to the database. These are MagickCore method. However, there are analogs in other languages such as Magick++, PerlMagick, etc.