• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Saving images to MySQL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving images to MySQL


  • Subject: Re: Saving images to MySQL
  • From: Colin Cornaby <email@hidden>
  • Date: Wed, 25 Jul 2007 11:55:32 -0700

If you're using SMySQL or whatever that framework is called these days, be aware that is has bugs in dealing with blobs. I was never able to save and retrieve an image saved as a blob. This was with the version of SMySQL included inside CocoaMySQL. The official distribution does not seem to support compiling as a Universal binary, and no one at work has had time to fix it.

What I've been doing is encoding pictures as Base64 and storing them as a string in the database. All our clients use the app on a multi- site LAN (about 12 sites connected by fiber), and the app has been absolutely snappy, even when under strain from 20-40 users at once. There definitely are no issues with storing pictures in the database, as long as they're not too big. We use the database for asset management, so the pictures are usually captured by iSight and are around 75k. When dealing with larger pictures, your milage may vary.

-Colin

On Jul 22, 2007, at 3:11 AM, Michael de Vries wrote:

For my first program I am trying to write in Cocoa I need to save images of products to a MySQL database.
I already have a connection to the database and I can send all information of a product to the database and retrieve it, but I don't know how to handle images.
I have searched google, but I have not found any good solutions or example code.


Probably I have to convert my NSImage to some sort of string representation and then save it to a BLOB field in the database, but how do I represent an image as a string?
And at least as important, how do I create an image of it when I retrieve this data from the database?


Am I thinking in the right direction, or should I handle things differently?

Tnx in advance, Michael
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Saving images to MySQL (From: Michael de Vries <email@hidden>)

  • Prev by Date: Re: problem with custom nsview as first responder
  • Next by Date: Is pointer syntax logical?
  • Previous by thread: Re: Saving images to MySQL
  • Next by thread: Adding a new row to NSTableView dynamically using bindings
  • Index(es):
    • Date
    • Thread