帆布面料图像,存储为对象并压缩它们

时间:2017-03-18 05:28:27

标签: php canvas fabricjs

<?php

class Mail{
  private $image_box;

  public $count = 0;
  public $zipper;

  $encoding = "base64";
  $type = "image/png";

  public function __construct(){
    $this->turnToImage();
  }

  public function addToObject($object_name, $object_data){
    //save to object 
    // $object_name : $object_data
  }

  public function turnToImage(){
    $this->image_box = $_POST['canvas_data'];

    foreach($this->image_box as $img)
    {
    $this->count++;
    $data = substr($img, strpos($img, ","));
    $image_name ="OrderImg".$this->count.".png";
    $this->addToObject($image_name, $data);
    }

  }

  public function toZip(){

  }

}

$Mail = new Mail();
?>

我有帆布面料图像数据,我想解码成图像并压缩并通过邮件发送。

所以第一个问题是我如何将我的数据保存到对象并且是这样的?

object{
$object_name1 : object_data1,
$object_name2 : object_data2
}

2我如何拉上它们?在我存储到对象和一些如何将它们拼接在一起作为一个zip文件?我被困在这里。

0 个答案:

没有答案