INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

LOAD,SAVE and RETRIVE PICTURE FROM MySql database USING DELPHI - HELP PLEASE !!!

LOAD,SAVE and RETRIVE PICTURE FROM MySql database USING DELPHI - HELP PLEASE !!!

LOAD,SAVE and RETRIVE PICTURE FROM MySql database USING DELPHI - HELP PLEASE !!!

(OP)
Hello,

I need help with delphi project. I use delphi 2007 and MySql Database.

1. I want to load picture from TOpenPictureDialog to TImage (or TDBImage).
2. Picture from Timage (or TDBImage) I want to save to MySql database in table Picture field 'IMG'(longblob).
3. I want to retrieve image from my database table 'IMG' and show in TImage (or TDBImage).
4. I will have DBGrid on my main form. When I clik on GBgrid row or when I scroll GBGrid I want to see that picture are changing.
5. How to convert jpg to gif, or how to Shrink picture or limit picture to be H:161px and W:138px, that is a size of my TImage.

My database(MySql) have 4 table (contacts, city, country and picture).
Database will be small maybe 200 contacts so I think that saving picture in database is not a problem.

On my Main form I have DBGrid, TImage (or TDBImage), AddContact button, ChangeContact Button, DeleteContact Button,
ChoosePicture Button, Save and Cancel Button, and DBEdit's from AdoDataSet,
TAdoConnection,TAdoDataSet and DataSource, TOpenPictureDialog.

This is my database:

CODE -->

CREATE TABLE `picture` (
 `ID` int(10) unsigned NOT NULL auto_increment,
 `CAPTION` varchar(45) default NULL,
 `IMG` longblob,
 PRIMARY KEY (`ID`)
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

 CREATE TABLE `country` (
 `ID` int(10) unsigned NOT NULL auto_increment,
 `NAME` varchar(45) NOT NULL,
 `AREACODE` varchar(45) default NULL,
 PRIMARY KEY (`ID`)
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

 CREATE TABLE `city` (
 `ID` int(10) unsigned NOT NULL auto_increment,
 `NAME` varchar(45) NOT NULL,
 `ZIPCODE` int(5) unsigned default NULL,
 `COUNTRYID` int(10) unsigned default NULL,
 PRIMARY KEY (`ID`),
 KEY `FK_city_1` (`COUNTRYID`),
 CONSTRAINT `FK_city_1` FOREIGN KEY (`COUNTRYID`) REFERENCES `country` (`ID`)
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

 CREATE TABLE `contacts` (
 `ID` int(10) unsigned NOT NULL auto_increment,
 `FIRSTNAME` varchar(45) NOT NULL,
 `LASTNAME` varchar(45) NOT NULL,
 `ADDRESS` varchar(45) default NULL,
 `PHONE` int(10) unsigned default NULL,
 `CITYID` int(10) unsigned default NULL,
 `PICID` int(10) unsigned default NULL,
 PRIMARY KEY (`ID`),
 KEY `FK_contacts_1` (`CITYID`),
 KEY `FK_contacts_2` (`PICID`),
 CONSTRAINT `FK_contacts_2` FOREIGN KEY (`PICID`) REFERENCES `picture` (`ID`),
 CONSTRAINT `FK_contacts_1` FOREIGN KEY (`CITYID`) REFERENCES `city` (`ID`)
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 
Thank you for your time and knowledge.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close