Quantcast

Store images in Hbase using Thrift and Php

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Store images in Hbase using Thrift and Php

dimpanagr
Hi I have set up HBase and trying to use Thrift-Php to upload an image and then display it. Is there any example or tutorial containing the neccessary php?

Thank you.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Store images in Hbase using Thrift and Php

Enis Söztutar
If you check out the latest source code, there are some examples under
hbase-examples/src/main/php.

Enis


On Thu, Mar 14, 2013 at 6:06 AM, dimpanagr <[hidden email]> wrote:

> Hi I have set up HBase and trying to use Thrift-Php to upload an image and
> then display it. Is there any example or tutorial containing the neccessary
> php?
>
> Thank you.
>
>
>
> --
> View this message in context:
> http://apache-hbase.679495.n3.nabble.com/Store-images-in-Hbase-using-Thrift-and-Php-tp4040223.html
> Sent from the HBase User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Store images in Hbase using Thrift and Php

dimpanagr
Thank you for your reply. I have seen DemoClient.php and tried to use mutateRow with a code like:

$tmpName=$_FILES["file"]["tmp_name"];
$fp = fopen($tmpName, 'r');
$data = fread($fp, filesize($tmpName));
$data = addslashes($data);
fclose($fp);
new Mutation( array(
            'column' => 'info:pic',
            'value' => $data
            ) ),
            );
$client->mutateRow( $t, $username, $mutations );

and then:

$arr = $client->getRow($t, $username);
foreach ( $arr as $k=>$TRowResult  ) {
$values = $TRowResult->columns;
asort( $values );
foreach ( $values as $k=>$v ) {
        $usr= $v->value;
        $content=$_GET['username'];
    header('Content-type: image/jpg');
        echo $usr;
}

But failed to display the image.

Enis Söztutar wrote
If you check out the latest source code, there are some examples under
hbase-examples/src/main/php.

Enis
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Store images in Hbase using Thrift and Php

Ted Yu-3
Did you get any error at client and server side ?

Thanks

On Mar 14, 2013, at 11:36 PM, dimpanagr <[hidden email]> wrote:

> Thank you for your reply. I have seen DemoClient.php and tried to use
> mutateRow with a code like:
>
> $tmpName=$_FILES["file"]["tmp_name"];
> $fp = fopen($tmpName, 'r');
> $data = fread($fp, filesize($tmpName));
> $data = addslashes($data);
> fclose($fp);
> new Mutation( array(
>            'column' => 'info:pic',
>            'value' => $data
>            ) ),
>            );
> $client->mutateRow( $t, $username, $mutations );
>
> and then:
>
> $arr = $client->getRow($t, $username);
> foreach ( $arr as $k=>$TRowResult  ) {
> $values = $TRowResult->columns;
> asort( $values );
> foreach ( $values as $k=>$v ) {
>        $usr= $v->value;
>        $content=$_GET['username'];
>    header('Content-type: image/jpg');
>        echo $usr;
> }
>
> But failed to display the image.
>
>
> Enis Söztutar wrote
>> If you check out the latest source code, there are some examples under
>> hbase-examples/src/main/php.
>>
>> Enis
>
>
>
>
>
> --
> View this message in context: http://apache-hbase.679495.n3.nabble.com/Store-images-in-Hbase-using-Thrift-and-Php-tp4040223p4040323.html
> Sent from the HBase User mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Store images in Hbase using Thrift and Php

Ted Yu-3
In reply to this post by dimpanagr
I think you hit this bug:
HBASE-8079 Mismatch of mutateRow() parameters between DemoClient.php and
gen-php/Hbase.php in 0.94

On Thu, Mar 14, 2013 at 11:36 PM, dimpanagr <[hidden email]> wrote:

> Thank you for your reply. I have seen DemoClient.php and tried to use
> mutateRow with a code like:
>
> $tmpName=$_FILES["file"]["tmp_name"];
> $fp = fopen($tmpName, 'r');
> $data = fread($fp, filesize($tmpName));
> $data = addslashes($data);
> fclose($fp);
> new Mutation( array(
>             'column' => 'info:pic',
>             'value' => $data
>             ) ),
>             );
> $client->mutateRow( $t, $username, $mutations );
>
> and then:
>
> $arr = $client->getRow($t, $username);
> foreach ( $arr as $k=>$TRowResult  ) {
> $values = $TRowResult->columns;
> asort( $values );
> foreach ( $values as $k=>$v ) {
>         $usr= $v->value;
>         $content=$_GET['username'];
>     header('Content-type: image/jpg');
>         echo $usr;
> }
>
> But failed to display the image.
>
>
> Enis Söztutar wrote
> > If you check out the latest source code, there are some examples under
> > hbase-examples/src/main/php.
> >
> > Enis
>
>
>
>
>
> --
> View this message in context:
> http://apache-hbase.679495.n3.nabble.com/Store-images-in-Hbase-using-Thrift-and-Php-tp4040223p4040323.html
> Sent from the HBase User mailing list archive at Nabble.com.
>
Loading...