#47982 [Opn]: Storing image binary data

From: Date: Thu, 16 Apr 2009 13:33:17 +0000
Subject: #47982 [Opn]: Storing image binary data
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-135881@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:           Open
 Bug Type:         MySQL related
 Operating System: XP
 PHP Version:      5.2CVS-2009-04-16 (snap)
 Assigned To:      mysql
 New Comment:

Sorry once again. Works when
$pdo->exec('SET CHARACTER SET utf8');
is commented.


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

[2009-04-16 13:28:11] markac at home dot pl

Strange, but when I using another remote database server 5.0.66a
everything is good. I thing problem is on my site (bad MySQL or PHP
configuration? ;/).

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

[2009-04-16 12:43:00] markac at home dot pl

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;

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

[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?

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

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 (#135881) next »