Example #1
0
 public static function go($img, $obj = NULL)
 {
     $api = new CreateImage($img, $obj);
     return $api->saveImg();
 }
Example #2
0
 public function snap($img, $hash)
 {
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, 'result' => array(), "func" => "snap");
     //----------------------------------------------------------
     $chk = CreateImage::go($img, array("dir" => GlobalMas::$filesPath_absolute . $hash));
     //----------------------------------------------------------
     print_r($chk);
     if ($chk['bool']) {
         $name = explode("/", $chk['result']);
         $name = array_pop($name);
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = InsertINTO::go("files", array('name' => $name, "hash" => '{hash}'));
     } else {
         return $chk;
     }
     //----------------------------------------------------------
     return $chk;
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, CreateImage $request)
 {
     $image = $this->image->update($request->all());
     return redirect('admin/image/' . $image->id)->with(array('status' => 'success', 'message' => 'L\'image a été mise à jour'));
 }
Example #4
0
 public function updateImg($img, $info)
 {
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, 'result' => array(), "func" => "updateImg");
     //----------------------------------------------------------
     $chk = CreateImage::go($img, array("dir" => $this->thumbRelPath));
     //----------------------------------------------------------
     if ($chk['bool']) {
         $name = explode("/", $chk['result']);
         $name = array_pop($name);
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = $this->insertFile($name, json_encode($upload["files"]));
     } else {
         return $chk;
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = Update::go("videos", array("images_id" => $chk['insert_id']), array("id" => $info['id']));
     } else {
         return $chk;
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk['message'] = "Thumbnal for '" . $info['title'] . "' has been changed successfully!!!";
     }
     //----------------------------------------------------------
     return $chk;
 }
 /**
  * Add an image
  *
  * @access public
  * @param array $dats Image to add and paramaters to use
  * @deprecated
  */
 public function fAddImage($dats = '')
 {
     try {
         if (isset($dats['name']) && file_exists($dats['name']) == 'true') {
             $attrImage = getimagesize($dats['name']);
             try {
                 if ($attrImage['mime'] == 'image/jpg' || $attrImage['mime'] == 'image/jpeg' || $attrImage['mime'] == 'image/png' || $attrImage['mime'] == 'image/gif') {
                     self::$intIdWord++;
                     $image = CreateImage::getInstance();
                     $dats['rId'] = self::$intIdWord;
                     $image->createImage($dats);
                     $this->_wordDocumentC .= (string) $image;
                     $dir = $this->parsePath($dats['name']);
                     $this->_zipDocx->addFile($dats['name'], 'word/media/image' . self::$intIdWord . '.' . $dir['extension']);
                     $this->generateDEFAULT($dir['extension'], $attrImage['mime']);
                     if ((string) $image != '') {
                         $this->_wordRelsDocumentRelsC .= $this->generateRELATIONSHIP('rId' . self::$intIdWord, 'image', 'media/image' . self::$intIdWord . '.' . $dir['extension']);
                     }
                 } else {
                     throw new Exception('Image format is not supported.');
                 }
             } catch (Exception $e) {
                 self::$log->fatal($e->getMessage());
                 exit;
             }
         } else {
             throw new Exception('Image does not exist.');
         }
     } catch (Exception $e) {
         self::$log->fatal($e->getMessage());
         exit;
     }
 }