Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 以BLOB形式存储-仅1 KB的数据,不存储图像_Php_Android_Mysql_File_Encode - Fatal编程技术网

Php 以BLOB形式存储-仅1 KB的数据,不存储图像

Php 以BLOB形式存储-仅1 KB的数据,不存储图像,php,android,mysql,file,encode,Php,Android,Mysql,File,Encode,我已将一个图像编码为base64,如下所示 Bitmap bitmapOrg= BitmapFactory.decodeFile(imagePath); ByteArrayOutputStream bao = new ByteArrayOutputStream(); bitmapOrg.compress(Bitmap.CompressFormat.JPEG, 90, bao); byte [] byarray = bao.toByt

我已将一个图像编码为base64,如下所示

        Bitmap bitmapOrg= BitmapFactory.decodeFile(imagePath);
        ByteArrayOutputStream bao = new ByteArrayOutputStream();
        bitmapOrg.compress(Bitmap.CompressFormat.JPEG, 90, bao);
        byte [] byarray = bao.toByteArray();
        String myimage=Base64.encodeBytes(byarray);

问题是,图像完全上传到服务器的“upload/”目录中。但不存储在mysql中。在mysql中,证据图像被设置为“BLOB”。在这个查询之后,“BLOB filenameB”存储在表中,看起来只有1KB。
请告诉我我做错了什么???

要在android程序中获取图像,我认为您需要通过本地主机或服务器上载的图像路径。要在应用程序中获取图像,请尝试以下操作:

    UrlImageViewHelper.setUrlDrawable("your imageview name",
                    "your image path in localhost or server", 
                    "optional image to display if not available in your drawable folder",
                    "cache duration");
您可以在此处获取库URLMageViewHelper:

$base = $_REQUEST['image'];
$filename = $_REQUEST['filename'];
$buffer=base64_decode($base);
$path = "upload/".$filename.".jpg";
$handle = fopen($path, 'wb');
$numbytes = fwrite($handle, $buffer);
fclose($handle);

$query = $link->prepare("UPDATE transaction evidenceimage=?,evidencename=? WHERE transactionID =   '5'");
        $values = array($path, $filename);
        $query->execute($values);   
        $counts= $query->rowCount();
                if ($counts>0)
                {
                    $rowset = $query->fetchAll();
                    $response["comments"]=array();
                    $comments =array();
                    $response["success"]=1;
                }
                else{
                $response["success"]=0;
                }
echo json_encode($response);
    UrlImageViewHelper.setUrlDrawable("your imageview name",
                    "your image path in localhost or server", 
                    "optional image to display if not available in your drawable folder",
                    "cache duration");