Closed robsteven192 closed 9 years ago
Hi @robsteven192 , Can you provide me an example, a record in the db and the query you're trying to do on that field?
If there is a bug i've to try to recreate the behaviour.
Hi I upload a picture using this method and can retrieve it and all other ones properly through Java with this The problem I am running into is I am not sure how to retrieve this data through PHP. I can obtain the Record for the Picture and the "binary" field contains an ID to another Record and I am not sure how to retrieve information about that Record to extract the binary data it is storing. There probably isn't a bug I just have no idea how to get the binary data. Thanks!
I decided to store the binary data in the document and not in a separate Record which made things a lot easier to do in PHP. Thanks for your time!
There was a bug and i fixed it.
Now, you can use this code to retrieve binary data:
require "vendor/autoload.php";
use PhpOrient\PhpOrient;
$client = new PhpOrient( 'localhost', 2424 );
$client->dbOpen( 'test', 'admin', 'admin' );
$user = $client->query( "select * from user where username = 'domenico'" );
/**
* @var \PhpOrient\Protocols\Binary\Data\Record $user[0]
*/
$record = $client->recordLoad( $user[0]->getOData()['pictures'][0] );
/**
* @var \PhpOrient\Protocols\Binary\Data\Record $record[0]
*/
$pic = $client->recordLoad( $record[0]->getOData()['binary'] );
/**
* @var \PhpOrient\Protocols\Binary\Data\Record $pic[0]
*/
file_put_contents( "my_file.png", $pic[0]->getOData()[0] );
Thank you! Especially for the quick fix!
Hello I am working with PhpOrient as well as the Java API and have ORecordBytes being stored and am having trouble retrieving the actual data with PhpOrient. I get the rid for the record but when I load the record from the database I do not know how to retrieve the binary data. Any help would be greatly appreciated!