我的应用程序正在通过内容类型为“application/octet-stream”的移动设备发送图像。PHP从应用程序/八位字节流创建图像
我需要使用GD库处理这些图像,这意味着我需要能够从数据创建图像对象。
通常,我一直在使用imagecreatefromjpeg,imagecreatefrompng,imagecreatefromgif等来处理从Web表单上传的文件,但这些似乎不适用于以应用程序/八位字节流的形式来到我的应用程序。
关于如何实现我的目标的任何想法?
编辑
下面是我用它来创建图像识别......我的处理程序完美的作品在我的网站上的代码,唯一的区别我可以在我的网站,并从iOS的数据之间是讲的内容 - 键入
public function open_image($path) {
# JPEG:
$im = @imagecreatefromjpeg($path);
if ($im !== false) { $this->image = $im; return $im; }
# GIF:
$im = @imagecreatefromgif($path);
if ($im !== false) { $this->image = $im; return $im; }
# PNG:
$im = @imagecreatefrompng($path);
if ($im !== false) { $this->image = $im; return $im; }
$this->error_messages[] = "Please make sure the image is a jpeg, a png, or a gif.";
return false;
}
对于GD如何处理数据,MIME类型应该没有意义。显示您使用的代码 – 2011-05-09 21:23:53
+1请向我们展示您使用的代码。 – 2011-05-09 21:32:21
我把代码放在那里,谢谢:) – johnnietheblack 2011-05-09 21:32:31