Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-18-2011, 10:47 PM   #1 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 4
snis781223 is on a distinguished road
Default How to download images to an imageview?

Hello! Everyone......

I am making an application now.

I want to download images to an imageview.

Who can tell me how to do?

My all images are saved in a MySQL database.

Who has the same experience please tell me......
snis781223 is offline   Reply With Quote
Old 08-18-2011, 11:29 PM   #2 (permalink)
el guaje
 
kevinyide's Avatar
 
Join Date: Jun 2010
Posts: 243
kevinyide is on a distinguished road
Send a message via Yahoo to kevinyide
Default

Assuming you know how to get your image data from the database, you can create an UIImage with a NSData object of your image data retrieved from the database using the initWithData method. Then set this UIImage to your UIImageView. There are several posts on this forum on populating imageviews with images directly from resources inside your project and also from databases.
kevinyide is offline   Reply With Quote
Old 08-19-2011, 02:04 AM   #3 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

the idea is to do a php script (or equivalent) that interact with your mysql databse and return a xml or json file that you can parse, containing the link of the image (or the base64 encoded image, but my advice is to use a link to the file if possible). Then you will use ASIHTTPRequest or NSURLConnection to do an asynchronous request to your php script, and then parse the xml\json returned with NSXMLParser or SBJson, at this point you will have a link to the file (that you can download again with ASIHTTPRequest or NSURLConnection) or a text that represent the image in base64, you can use this tip to convert base64 string to NSData and then create a UIImage with that.
__________________
dany_dev is offline   Reply With Quote
Reply

Bookmarks

Tags
database, image download

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 391
14 members and 377 guests
7twenty7, chiataytuday, cristofercolmbos, dedeys78, fiftysixty, gmarro, iOS.Lover, jimmyon122, jonathandeknudt, pungs, raymng, stanny, tymex, UMAD
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,669
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, dedeys78
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:09 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0