Instantiate from memory / mysql select

See all posts Reply

Instantiate from memory / mysql select new!
by Dave, 15 years, 6 months ago
Hi,

I don't want to store images as files, but rather as MySQL BLOB(s), is it possible to instantiate with the data returned from mysql? (or a variable/memory?)

Cheers

DaveReply
Re: Instantiate from memory / mysql select new!
by colin, 15 years, 5 months ago
You can store the processed image in your database, if you call Process() without an argument. For instance, to output the image content directly to the browser, you would do:
$handle = new upload($_FILES['image_field']);
header('Content-type: ' . $handle->file_src_mime);
echo $handle->Process();
die();

But you can instantiate the class only with a file (local or uploaded). So you would have to dump your BLOB field in a file before using the class on it.Reply