【问题标题】:upload and display image in circular image json android以圆形图像json android上传并显示图像
【发布时间】:2018-06-28 12:55:18
【问题描述】:
<?php

$dir = 'uploads/';

if (isset($_REQUEST['image'])) {
    $base = $_REQUEST['image'];
    $current_timestamp = time();
    $current_timestamp = (string)$current_timestamp;
    $filename = $current_timestamp . '-' . basename($_REQUEST['filename']);

    $binary = base64_decode($base);
    header('Content-Type: bitmap; charset=utf-8');
    $file = fopen($dir . $filename, 'wb');

    fwrite($file, $binary);
    fclose($file);

    header('Content-Type: text/html');
    echo $filename;
}

图片上传不工作

在圆形图像视图Android JSON PHP中上传和显示图像

【问题讨论】:

  • 欢迎来到 SO!请查看 SO 的 how to ask 部分,因为我不确定您的真正要求是什么
  • 它到底是怎么不工作的?实际结果是什么,您期望什么?以及如何上传?
  • @VladMatvienko 图像已上传,但我想在 android 中以圆形图像视图查看是否有任何编码
  • 所以你基本上是想把ImageView圈起来吧?你试过搜索吗?

标签: php android image upload display


【解决方案1】:

所以我修改了你的代码。试试这个:

if (isset($_REQUEST['image'])){ 

    $base = $_REQUEST['image'];
    $current_timestamp = time();
    $current_timestamp = (string)$current_timestamp; 
  $filename = $current_timestamp . '-' . basename($_REQUEST['filename']);
    $base = str_replace(' ','+', $base); 
    $binary = base64_decode($base);  
    header('Content-Type: bitmap; 
charset=utf-8'); 
    $file = fopen($dir . $filename, 'wb'); 
    fwrite($file, $binary);
    fclose($file); header('Content-Type: text/html'); 
    echo $filename; 

}

【讨论】:

    猜你喜欢
    • 2021-03-17
    • 1970-01-01
    • 2019-05-25
    • 1970-01-01
    • 2020-06-05
    • 2022-01-05
    • 1970-01-01
    • 2019-11-08
    • 1970-01-01
    相关资源
    最近更新 更多