this seems to work, but there are unanswered questions and is still undergoing investigation. It appears that the data stored with os_content = 1 is not being escaped in all circumstances or the scaled image data is being escaped twice.

This commit is contained in:
zotlabs 2016-10-23 21:27:10 -07:00
parent 39f0707201
commit 20194bed42

View File

@ -134,12 +134,15 @@ class dba_pdo extends dba_driver {
function unescapebin($str) { function unescapebin($str) {
if($this->driver_dbtype === 'pgsql') { if($this->driver_dbtype === 'pgsql') {
$x = '';
while(! feof($str)) {
$x .= fread($str,8192);
}
if(substr($x,0,2) === '\\x') {
$x = hex2bin(substr($x,2));
}
return $x;
// The initial backslash inserted by escapebin above will have been stripped
// by the postgres server, leaving us with '\x{hexdigits}'
// The PDO driver returns bytea fields as streams, so fetch the content with fgets
return hex2bin(substr(fgets($str),2));
} }
else { else {
return $str; return $str;