in reply to Updating binary data through DBI
The first question is why are you trying to compress images? Most formats are already efficiently compressed so there is very little mileage in this*. Anyway if you read the DBI docs and conform to best practice you will use place holders:
When trying to insert long or binary values, placeholders should be used since there are often limits on the maximum size of an INSERT statement and the quote method generally can't cope with binary data.
$sth_q = $dbh->prepare_cached( 'SELECT Image FROM Table1 WHERE Id = ?' + ); $sth_u = $dbh->prepare_cached( 'UPDATE Table1 SET Image = ? WHERE Id = + ?' ); # blah $sth_u->execute( $image, $id );
* The main exception is M$ .BMP files which are not compressed by default. You can compress these very effectively and may well see compression of 95-98%. This only really serves to bring them towards the same size as an equivalent gif or png.....
cheers
tachyon
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Updating binary data through DBI
by EyeOpener (Scribe) on Jun 18, 2004 at 19:55 UTC |