<?php
/**
 * Description of Image
 * @tableName tbl_image
 * @author ABC
 */
class ExtendedImage{
    /**
     * @columnName IMAGE_ID
     * @type int
     * @primary 
     */
    private $id;
    /**
     * @columnName IMAGE_NAME
     * @type string
     */
    private $imageName;
    /**
     * @columnName IMAGE_CREATED_DATE
     * @type int
     * @jsonDate
     */
    private $createdDate;
    /**
     * @columnName IMAGE_PATH
     * @type string
     */
    private $imagePath;
    
    /**
     * @columnName  IMAGE_DESC
     * @type string
     */
    private $desc;
    
    private $dPath;
    public function getPaths() {
         $map=new Map();
         if ($this->getImagePath() != "") {
                $map->put("imagePath", $_SERVER["V_PATH"]."content/".base64_encode($this->getId()). "/org");
                $map->put("thumb1",  $_SERVER["V_PATH"]."content/".base64_encode($this->getId()). "/tn");
                $map->put("thumb2", $_SERVER["V_PATH"]."content/".base64_encode($this->getId()) . "/tm");
                $map->put("thumb3", $_SERVER["V_PATH"]."content/".base64_encode($this->getId()). "/ts");
                $map->put("thumb4", $_SERVER["V_PATH"]."content/".base64_encode($this->getId()) . "/ev");
                $map->put("thumb5", $_SERVER["V_PATH"]."content/".base64_encode($this->getId()) . "/cd");
                return $map;
        }
        
    }

    public function getDPath() {
        return $this->dPath;
    }

    public function setDPath($dPath) {
        $this->dPath = $dPath;
    }

    public function getDesc() {
        return $this->desc;
    }

    public function setDesc($desc) {
        $this->desc = $desc;
    }

    public function getId() {
        return $this->id;
    }

    public function setId($id) {
        $this->id = $id;
    }

    public function getImageName() {
        return $this->imageName;
    }

    public function setImageName($imageName) {
        $this->imageName = $imageName;
    }

    public function getCreatedDate() {
        return $this->createdDate;
    }

    public function setCreatedDate($createdDate) {
        $this->createdDate = $createdDate;
    }

    public function getImagePath() {
        return $this->imagePath;
    }

    public function setImagePath($imagePath) {
        $this->imagePath = $imagePath;
    }

    public function toJson() {
        $map = new Map();
        $map->put("id", $this->getId());
        $map->put("imageName", $this->getImageName());
        $map->put("createdDate", TUtilDate::getMilisecondsFromDate($this->getCreatedDate()));
        $map->put("desc", $this->getDesc());
        $map->put("dpath",$this->getDPath());
        if ($this->getImagePath() != "") {
                $map->put("imagePath", $_SERVER["V_PATH"]."content/".base64_encode($this->getId()). "/org");
                $map->put("thumb1",  $_SERVER["V_PATH"]."content/".base64_encode($this->getId()). "/tn");
                $map->put("thumb2", $_SERVER["V_PATH"]."content/".base64_encode($this->getId()) . "/tm");
                $map->put("thumb3", $_SERVER["V_PATH"]."content/".base64_encode($this->getId()). "/ts");
                $map->put("thumb4", $_SERVER["V_PATH"]."content/".base64_encode($this->getId()) . "/ev");
                $map->put("thumb5", $_SERVER["V_PATH"]."content/".base64_encode($this->getId()) . "/cd");
        }

        return $map->toJson();
    }

}

?>
