#47982 [Fbk->Opn]: Storing image binary data

From: Date: Thu, 16 Apr 2009 12:43:01 +0000
Subject: #47982 [Fbk->Opn]: Storing image binary data
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-135877@lists.php.net to get a copy of this message
 ID:               47982
 User updated by:  markac at home dot pl
 Reported By:      markac at home dot pl
-Status:           Feedback
+Status:           Open
 Bug Type:         MySQL related
 Operating System: XP
 PHP Version:      5.2CVS-2009-04-16 (snap)
 Assigned To:      mysql
 New Comment:

Apache 2.2.11
PHP 5.2.9-1
MySQL 5.1.31-ommunity

MySQL Client API version 5.0.51a
PDO Driver for MySQL, client library version 5.0.51a

Table structure:

CREATE TABLE users (
  id int(10) unsigned NOT NULL AUTO_INCREMENT,
  username varchar(45) CHARACTER SET latin2 NOT NULL,
  password varchar(45) CHARACTER SET latin2 COLLATE latin2_bin NOT
NULL,
  email varchar(45) DEFAULT '',
  memo text,
  first_name varchar(45) NOT NULL,
  last_name varchar(45) NOT NULL,
  removed tinyint(1) unsigned NOT NULL DEFAULT '0',
  locked tinyint(1) unsigned NOT NULL DEFAULT '1',
  avatar blob,
  PRIMARY KEY (id) USING BTREE,
  UNIQUE KEY Index_2 (username)
) ENGINE=InnoDB AUTO_INCREMENT=112 DEFAULT CHARSET=utf8;


Previous Comments:
------------------------------------------------------------------------

[2009-04-16 12:21:36] johannes@php.net

I wasn't able to reproduce the issue. Could you please give me the
mysql version (the server version as well as the version of the mysql
client library used (see phpinfo() output) and the table defintion of
your table. Thanks.

------------------------------------------------------------------------

[2009-04-16 09:37:03] markac at home dot pl

OK. previous example also working witchout this code:
$pdo->exec('SET CHARACTER SET utf8');

How use UTF-8 and blob columns?

------------------------------------------------------------------------

[2009-04-16 09:31:47] markac at home dot pl

$image = fopen('image.jpg','rb'); 
$sth->bindValue(':avatar', $image, PDO::PARAM_LOB);

Also not working, but when I remove this code:
$pdo->exec('SET CHARACTER SET utf8');

then is working in this example.
Any suggestion?

------------------------------------------------------------------------

[2009-04-16 08:56:23] pajoye@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

and mysql != PDO


------------------------------------------------------------------------

[2009-04-16 08:50:30] markac at home dot pl

Sorry, replace $avatar to $user->avatar from all. Function argument is
an object $user, 'avatar' and 'id' is properties.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/47982

-- 
Edit this bug report at http://bugs.php.net/?id=47982&edit=1



Thread (16 messages)

« previous php.bugs (#135877) next »