1

I have a linux app programmed in C which uses gdk for image stuff. The images are sent to a remote server through FTP (with libcurl).

Currently I'm saving the images first to a local hard disk with gdk_pixbuf_save, but this seems kinda useless step. How difficult would it be to save the images directly on the remote server? I would also need to use the quality setting of jpg.

drwn
  • 82
  • 1
  • 6

1 Answers1

1

There is a gdk_pixbuf_save_to_buffer that can store data to a gchar buffer.

I wasn't able to quickly find the CURL API associated with FTP put requests; hopefully you'll be familiar enough with CURL to know how to put a file using a buffer as contents.

sarnold
  • 102,305
  • 22
  • 181
  • 238
  • Now I was finally able to test this and I ran into a following problem: how do I properly allocate memory for the gchar buffer gdk_pixbuf_save_to_buffer uses, as I don't think I know beforehand how big the resulting jpg will be? I'm also not very familiar with memory management in C. – drwn Feb 26 '12 at 00:50
  • Sorry I didn't see the question about memory allocation; if you want to add a new answer with the details on memory allocation and curl API, that'd be superb, so someone else with a similar question in the future can save the time. – sarnold Feb 27 '12 at 23:03
  • I actually made [completely another question](http://stackoverflow.com/questions/9453996/sending-an-image-to-ftp-server-from-gchar-buffer-libcurl) because i had a bigger problem with the CURL callback function, and there is a great answer given to it. – drwn Mar 01 '12 at 17:29