image to db problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lostboy
Forum Contributor
Posts: 329
Joined: Mon Dec 30, 2002 8:12 pm
Location: toronto,canada

image to db problem

Post by lostboy »

Hi Guys,

Question: Is there a limit to the size of an image that can be loaded into mysql with PHP? I know, I know, but its not my decision to do this. The powers that be are rather close minded about this.

I have heard there is a 64k limit to a single variable and obviously a 64K variable can't hold a 1.5M image, can it?

The goal of this little task is copy certain rows of data from a remote host DB to a local system (and eventually to re-sync the host db).
Please let me know your thoughts...

TIA
choppsta
Forum Contributor
Posts: 114
Joined: Thu Jul 03, 2003 11:11 am

Post by choppsta »

I presume you are referring to storing the images (binary data) in a MySQL database...

Don't quote me on this, but I think the size is only limited to the amount of disk space available...
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

'BLOB' type can only hold 64K, 'MEDIUMBLOB' type can only hold 1.6 MB, but 'LONGBLOB' can hold 4.2 GB - so that should be big enough to hold anything you want.MySQL table sizesare kind of limited too.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
lostboy
Forum Contributor
Posts: 329
Joined: Mon Dec 30, 2002 8:12 pm
Location: toronto,canada

Post by lostboy »

So there are no PHP limits to the size of the data in the variable? We have data fields that hold more than 85K...is this a problem...this is what I need to sort out

Thanks
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

I don't think there's a MySQL limit to the size of the data in a particular field beyond those restricted by the column type. I've got fields with over 300K and there's no problem. Like I said, LONGBLOB can hold 4.2 GB, so you should be fine.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
lostboy
Forum Contributor
Posts: 329
Joined: Mon Dec 30, 2002 8:12 pm
Location: toronto,canada

Post by lostboy »

thanks
Post Reply