public static function editar()
 {
     $cracha = new Cracha();
     $cracha->selecionarPorId($_GET['id']);
     if (!empty($_POST)) {
         $nomeCracha = $_POST['nome'];
         $idParticipante = $_POST['idParticipante'];
         $funcao = $_POST['funcao'];
         if (!empty($_FILES["foto_cracha"]["name"])) {
             $nomeFoto = $idParticipante . '-' . Util::substituiCaracteres($nomeCracha) . '.' . pathinfo($_FILES['foto_cracha']['name'], PATHINFO_EXTENSION);
             $foto = WideImage::loadFromUpload('foto_cracha');
             $imagem = $foto->crop($_POST['foto_x'], $_POST['foto_y'], $_POST['foto_w'], $_POST['foto_h']);
             @unlink('../fotosParticipantes/' . $nomeFoto);
             $imagem->saveToFile('../fotosParticipantes/' . $nomeFoto);
             $cracha->foto = $nomeFoto;
         }
         $cracha->nome = $nomeCracha;
         $cracha->funcao = $funcao;
         $cracha->fk_participante = $idParticipante;
         $cracha->salvar();
         self::redirecionar(Configuracao::$baseUrl . 'cracha/listar' . Configuracao::$extensaoPadrao);
     }
     self::$variaveis = array('cracha' => $cracha);
     self::$corpo = "editar";
     self::renderizar(self::$viewController);
 }
Exemple #2
0
 function testRotate45()
 {
     $img = WideImage::load(IMG_PATH . '100x100-rainbow.png');
     $new = $img->rotate(45);
     $this->assertEquals(142, $new->getWidth());
     $this->assertEquals(142, $new->getHeight());
 }
Exemple #3
0
 function testMagicCallDrawRectangle()
 {
     $img = WideImage::createTrueColorImage(10, 10);
     $canvas = $img->getCanvas();
     $canvas->filledRectangle(1, 1, 5, 5, $img->allocateColorAlpha(255, 0, 0, 64));
     $this->assertRGBAt($img, 3, 3, array('red' => 255, 'green' => 0, 'blue' => 0, 'alpha' => 64));
 }
Exemple #4
0
 /**
  * Returns an image with a resized canvas
  * 
  * The image is filled with $color. Use $scale to determine, when to resize.
  *
  * @param WideImage_Image $img
  * @param smart_coordinate $width
  * @param smart_coordinate $height
  * @param smart_coordinate $left
  * @param smart_coordinate $top
  * @param int $color
  * @param string $scale 'up', 'down', 'any'
  * @return WideImage_Image
  */
 function execute($img, $width, $height, $left, $top, $color, $scale)
 {
     $new_width = WideImage_Coordinate::fix($width, $img->getWidth());
     $new_height = WideImage_Coordinate::fix($width, $img->getHeight());
     if ($scale == 'down') {
         $new_width = min($new_width, $img->getWidth());
         $new_height = min($new_height, $img->getHeight());
     } elseif ($scale == 'up') {
         $new_width = max($new_width, $img->getWidth());
         $new_height = max($new_height, $img->getHeight());
     }
     $new = WideImage::createTrueColorImage($new_width, $new_height);
     if ($img->isTrueColor()) {
         if ($color === null) {
             $color = $new->allocateColorAlpha(0, 0, 0, 127);
         }
     } else {
         imagepalettecopy($new->getHandle(), $img->getHandle());
         if ($color === null) {
             if ($img->isTransparent()) {
                 $new->copyTransparencyFrom($img);
                 $tc_rgb = $img->getTransparentColorRGB();
                 $color = $new->allocateColorAlpha($tc_rgb);
             } else {
                 $color = $new->allocateColorAlpha(255, 0, 127, 127);
             }
             imagecolortransparent($new->getHandle(), $color);
         }
     }
     $new->fill(0, 0, $color);
     $x = WideImage_Coordinate::fix($left, $new->getWidth(), $img->getWidth());
     $y = WideImage_Coordinate::fix($top, $new->getHeight(), $img->getHeight());
     $img->copyTo($new, $x, $y);
     return $new;
 }
Exemple #5
0
 /**
  * 
  * @param array $files
  * @param array $post
  */
 public function uploadBanner(array $files, array &$post, $width = 800, $height = 350)
 {
     if (!empty($files) && $files['arquivo']['error'] == 0) {
         try {
             $extensionPermiss = array('jpg', 'jpeg', 'png', 'gif');
             /* codigo de upload */
             if (!file_exists($this->path)) {
                 mkdir($this->path);
             }
             /**
              * Verificar os dados do arquivo
              */
             $fullName = pathinfo($files['arquivo']['name'], PATHINFO_BASENAME);
             $fileName = pathinfo($files['arquivo']['name'], PATHINFO_FILENAME);
             $extension = pathinfo($files['arquivo']['name'], PATHINFO_EXTENSION);
             $pathFile = $this->path . DS . URL::sanitizeTitleWithDashes($fileName) . '.' . $extension;
             if (in_array(strtolower($extension), $extensionPermiss)) {
                 require_once "Library/wideimage/WideImage.php";
                 WideImage::load($files['arquivo']['tmp_name'])->resize($width, $height, 'outside')->saveToFile($pathFile, 90);
                 $post['imagem'] = URL::sanitizeTitleWithDashes($fileName) . '.' . $extension;
             } else {
                 throw new Exception('é permitido somente arquivos do tipo ' . join(',', $extensionPermiss));
             }
         } catch (Exception $ex) {
             throw $ex;
         }
     }
 }
Exemple #6
0
 /**
  * Filter with wideimage (must be installed)
  *  
  * @param mixed $from
  * @param mixed $to
  * @param mixed $format
  */
 static function runWideImage($from, $to, $format)
 {
     if (!class_exists('WideImage')) {
         core::dprint('WideImage not exists!', core::E_CRIT);
         return;
     }
     core::dprint('<<Wideimage ' . __FUNCTION__ . ' ' . join(', ', $format) . ' -- ' . (string) $to, core::E_DEBUG4);
     $image = WideImage::load($from);
     /** @var $converted \WideImage_Image */
     $converted = false;
     $method = array_shift($format);
     /*
     Fatal error: Uncaught exception 'WideImage_Operation_InvalidResizeDimensionException' with message
              'Both dimensions must be larger than 0.' in vendor\spekkionu\wideimage\WideImage\Operation\Resize.php:123
     */
     if (is_callable(array($image, $method))) {
         try {
             $converted = call_user_func_array(array($image, $method), $format);
         } catch (Exception $e) {
             core::dprint(' ..convert image failed: ' . $e->getMessage(), core::E_DEBUG4);
         }
     }
     if ($converted) {
         $converted->saveToFile($to);
     }
 }
 public function editarAction()
 {
     $id = $this->getRequest()->getParam('id');
     $this->view->breadcrumb = array($this->title => 'gestao/banner-home/editar');
     $this->view->rs = $rs = $this->_service->getByid($id);
     if (is_null($rs)) {
         $this->_helper->flashMessenger->addMessage('Operação não permitida!');
         $this->_redirect('/gestao/banner-home/');
     }
     if ($this->_request->isPost()) {
         $data = array('id' => $rs['id'], 'titulo' => $this->_dataPost['titulo'], 'link_saibamais' => $this->_dataPost['link_saibamais'], 'link_reservar' => $this->_dataPost['link_reservar'], 'descricao' => $this->_dataPost['descricao']);
         if ($_FILES['imagem']['name'] != '') {
             require_once '/WideImage/WideImage.php';
             try {
                 $image = WideImage::load('imagem');
             } catch (Exception $e) {
                 $this->_helper->flashMessenger->addMessage('Imagem inválida!');
                 $this->_redirect('/gestao/banner-home');
             }
             $nomeImagem = date('dmYGis');
             $image->saveToFile('img/upload/' . $nomeImagem . '.jpg', 60);
             $image->crop('center', 'center', 920, 650)->saveToFile('img/upload/' . $nomeImagem . '-mobile.jpg', 60);
             $data['imagem'] = 'img/upload/' . $nomeImagem . '.jpg';
             $data['imagem_mobile'] = 'img/upload/' . $nomeImagem . '-mobile.jpg';
             unlink($rs['imagem']);
             unlink($rs['imagem_mobile']);
         }
         $return = $this->_service->update($data);
         if ($return) {
             $this->_helper->flashMessenger->addMessage('Atualizado com sucesso!');
             $this->_redirect('/gestao/banner-home/');
         }
     }
 }
Exemple #8
0
 /**
 * @public
 * 
 * @param array $param Valores das variáveis
 * 
 * @example $this->WideImageOne($param = array(
  'Path'=>  array($this->getPathFile('destaque')), //Destino
  'Name'=>$_POST['nome'], //Nome da Foto
  'Size'=>array('239x239'), //Tamanho da Foto
  'File'=>'foto',             //Nome do $_FILES
  //'Delete'=>$foto['foto'], //Deve ser usando quando for upadte
  ));
 * 
 * @return string Retorna o nome da foto
 */
 public function WideImageOne($param)
 {
     self::extensions('wideImage.lib.WideImage');
     $file = $_FILES[$param['File']];
     $type = explode('/', $file['type']);
     $name = $this->caracteres($param['Name'] . '-' . rand(1, 300) . '.' . $type[1]);
     $i = 0;
     $count = count($param['Path']);
     while ($i < $count) {
         if (!is_dir($param['Path'][$i])) {
             echo "Path \n{$param['Path'][$i]}\n naõ encotrado";
             die;
         }
         if (isset($param['Delete']) && !empty($param['Delete'])) {
             if (!$this->WideImageDelete(array('Path' => $param['Path'][$i], 'Name' => $param['Delete']))) {
                 echo '';
             }
         }
         $_load = WideImage::load($file['tmp_name']);
         $size = explode('x', $param['Size'][$i]);
         $_resize = $_load->resize((int) $size[0], (int) $size[1]);
         $_resize->saveToFile($param['Path'][$i] . $name);
         unset($_load, $_resize);
         chmod($param['Path'][$i] . $name, 775);
         ++$i;
     }
     return $name;
 }
Exemple #9
0
 public function addAction()
 {
     $config = Config::getInstance();
     $config = $config->getConfig();
     $Cars = new Cars();
     $this->view->data = $Cars->getCategory();
     $model = $this->request->getPost('model');
     $marka = $this->request->getPost('marka_id');
     $opis = $this->request->getPost('opis');
     $zdjecie = $this->request->getFiles('zdjecie');
     if ($model == NULL && $marka == NULL && $opis == NULL && $zdjecie == NULL) {
         $this->view->display('add');
     } else {
         if ($model == NULL || $marka == NULL || $opis == NULL || $zdjecie == NULL) {
             echo "Uzupelnij wszystkie pola";
         } else {
             $podpis = date("Y-m-d G:i:s", time());
             $zdjecie = WideImage::loadFromUpload('zdjecie');
             $zdjecie->saveToFile($config['DOC_ROOT'] . $config['CUSTOM_IMG_DIR'] . $podpis . '.png');
             $Car = new Cars();
             $Car->saveCar($model, $marka, $opis, $podpis);
             header('location: ' . Url::getUrl('car', 'list', array('status' => 8)));
         }
     }
 }
 /**
  * Returns the path to the library
  *
  * @return string
  */
 static function path()
 {
     if (self::$path === null) {
         self::$path = dirname(__FILE__) . DIRECTORY_SEPARATOR;
     }
     return self::$path;
 }
Exemple #11
0
 public function upload(Model $Model, $arquivo = array(), $altura = 800, $largura = 600, $pasta = null, $nome_arquivo)
 {
     // App::uses('Vendor', 'wideimage');
     App::import('Vendor', 'WideImage', array('file' => 'WideImage' . DS . 'WideImage.php'));
     App::uses('Folder', 'Utility');
     $ext = array('image/jpg', 'image/jpeg', 'image/pjpeg', 'image/x-jps', 'image/png', 'image/gif');
     if ($arquivo['error'] != 0 || $arquivo['size'] == 0) {
         return false;
     }
     $img = WideImage::load($arquivo['tmp_name']);
     $folder = new Folder();
     $pathinfo = pathinfo($arquivo['name']);
     if ($folder->create(WWW_ROOT . 'img' . DS . $pasta . DS)) {
         //se conseguiu criar o diretório eu dou permissão
         $folder->chmod(WWW_ROOT . 'img' . DS . $pasta . DS, 0755, true);
     } else {
         return false;
     }
     $pathinfo['filename'] = strtolower(Inflector::slug($pathinfo['filename'], '-'));
     $arquivo['name'] = $nome_arquivo . '.' . $pathinfo['extension'];
     $img->saveToFile(WWW_ROOT . 'img' . DS . $pasta . DS . 'original_' . $arquivo['name']);
     $img = $img->resize($largura, $altura, 'fill');
     $img->saveToFile(WWW_ROOT . 'img' . DS . $pasta . DS . $arquivo['name']);
     // debug(WWW_ROOT.'img'.DS.$pasta.DS.$arquivo['name']); die;
     return $arquivo['name'];
 }
Exemple #12
0
 public function display($filename, $setting_index = 0)
 {
     if (!file_exists($filename)) {
         throw new Exception('Image <code>' . $filename . '</code> could not be found.');
     }
     // Get size
     if (isset($this->settings[$setting_index])) {
         $setting = $this->settings[$setting_index];
     } else {
         $setting_index = 0;
         $setting = NULL;
     }
     $cache_filename = $this->cache_dir . md5($filename . $setting_index);
     // Remove cache
     if (file_exists($cache_filename) && (filectime($filename) > filectime($cache_filename) || self::FORCE_GENERATE_CACHE)) {
         unlink($cache_filename);
     }
     // Generate image and cache
     if (!file_exists($cache_filename)) {
         $img = $this->generateCache($filename, $cache_filename, $setting);
     } else {
         $img = WideImage::load($cache_filename);
     }
     // Display
     if ($setting) {
         $img->output($setting['format'], $setting['quality']);
     } else {
         $img->output(self::DEFAULT_FORMAT, self::DEFAULT_QUALITY);
     }
     $img->destroy();
 }
Exemple #13
0
 function execute($image)
 {
     $mask = WideImage::load(DEMO_PATH . 'masks/' . $this->fields['mask']->value);
     $left = $this->fields['left']->value;
     $top = $this->fields['top']->value;
     return $image->applyMask($mask, $left, $top);
 }
Exemple #14
0
 function execute($image, $request)
 {
     $overlay = WideImage::load(DEMO_PATH . 'images/' . $this->fields['overlay']->value);
     $left = $this->fields['left']->value;
     $top = $this->fields['top']->value;
     $opacity = $this->fields['opacity']->value;
     return $image->merge($overlay, $left, $top, $opacity);
 }
 public function cria()
 {
     if (!empty($_GET['idCamp'])) {
         $_SESSION['idCamp'] = $_GET['idCamp'];
     }
     if (isset($_SESSION['idCamp'])) {
         $dados = $dados2 = $dados4 = $this->db->get_where('campanha', array('id' => $_SESSION['idCamp']))->row_array(0);
         $dados3 = array();
         $emp = str_replace(";", ",", $dados['empreendimento']);
         if ($emp != "") {
             $dados3 = $this->db->query("SELECT * FROM empreendimento WHERE id IN ({$emp}) ORDER BY empreendimento ASC")->result_array();
         }
         if (count($dados3) > 0) {
             include './application/assets/misc/wideimage/WideImage.php';
             foreach ($dados3 as $d) {
                 $pastaOrigem = '../' . $d['pasta'] . '/galeria';
                 $pastaDest = '../' . $dados['pasta'] . '/galeria';
                 # Copia
                 $origem = $pastaOrigem . "/" . $d['topo'];
                 $destino = $pastaDest . "/preview_" . $d['id'] . '.jpg';
                 copy($origem, $destino);
                 list($width, $height, $type, $attr) = getimagesize($origem);
                 # Resize
                 $img = WideImage::load($destino);
                 $resized = $img->resize(400, null);
                 $resized = $resized->crop('center', 'top', 400, 260);
                 $resized->saveToFile($destino);
                 $img->destroy();
             }
         }
     } else {
         $dados = UtilFunctions::getColunaTable('campanha');
     }
     if (isset($_POST['formSubmit']) && $_POST['formSubmit'] == true) {
         switch ($_POST['passo']) {
             case 1:
                 if ($dados['id'] == "") {
                     $this->create();
                 } else {
                     $this->update();
                 }
                 break;
             case 2:
                 $this->scripts();
                 break;
             case 3:
                 $this->empreendimento();
                 break;
             case 4:
                 $this->video();
                 break;
         }
     }
     $this->load->view('topo');
     $this->load->view(strtolower($this->area) . '/cria', array('dados' => $dados, 'dados2' => isset($dados2) ? $dados2 : "", 'dados3' => isset($dados3) ? $dados3 : "", 'dados4' => isset($dados4) ? $dados4 : ""));
     $this->load->view('rodape');
 }
 function testAutocropHalfImageBug()
 {
     $img = WideImage::load(IMG_PATH . '100x100-red-spot-half-cut.png');
     $cropped = $img->autocrop();
     $this->assertTrue($cropped instanceof WideImage_TrueColorImage);
     $this->assertEquals(22, $cropped->getWidth());
     $this->assertEquals(23, $cropped->getHeight());
     $this->assertRGBNear($cropped->getRGBAt(10, 10), 255, 0, 0);
 }
 public function testApplyConvolution()
 {
     $img = WideImage::load(IMG_PATH . '100x100-color-hole.gif');
     $result = $img->applyConvolution([[2, 0, 0], [0, -1, 0], [0, 0, -1]], 1, 220);
     $this->assertTrue($result instanceof WideImage_TrueColorImage);
     $this->assertTrue($result->isTransparent());
     $this->assertEquals(100, $result->getWidth());
     $this->assertEquals(100, $result->getHeight());
 }
 function test()
 {
     $img = WideImage::load(IMG_PATH . '100x100-color-hole.gif');
     $result = $img->correctGamma(1, 2);
     $this->assertTrue($result instanceof WideImage_PaletteImage);
     $this->assertTrue($result->isTransparent());
     $this->assertEquals(100, $result->getWidth());
     $this->assertEquals(100, $result->getHeight());
 }
Exemple #19
0
 /**
  * Load an image an instanciate a new Image class
  * 
  * @param string $source    Path to the image to load
  * @return Image 
  */
 public static function load($source)
 {
     $instance = parent::load($source);
     $instance->source = $source;
     $instance->basename = basename($source);
     $instance->name = substr($instance->basename, 0, strrpos($instance->basename, '.'));
     $instance->extension = substr($instance->basename, strrpos($instance->basename, '.'));
     return $instance;
 }
 function testApplyFilter()
 {
     $img = WideImage::load(IMG_PATH . '100x100-color-hole.gif');
     $result = $img->applyFilter(IMG_FILTER_EDGEDETECT);
     $this->assertTrue($result instanceof WideImage_TrueColorImage);
     $this->assertTrue($result->isTransparent());
     $this->assertEquals(100, $result->getWidth());
     $this->assertEquals(100, $result->getHeight());
 }
Exemple #21
0
 public function testSaveAndLoad()
 {
     $handle = imagecreatefromgif(IMG_PATH . '100x100-color-hole.gif');
     $this->mapper->save($handle, IMG_PATH . 'temp/test.gd');
     $this->assertTrue(filesize(IMG_PATH . 'temp/test.gd') > 0);
     imagedestroy($handle);
     // file is a valid image
     $handle = $this->mapper->load(IMG_PATH . 'temp/test.gd');
     $this->assertTrue(WideImage::isValidImageHandle($handle));
     imagedestroy($handle);
 }
 function testTransparentCorner()
 {
     $img = WideImage::load(IMG_PATH . '100x100-blue-alpha.png');
     $res = $img->roundCorners(30, null, WideImage::SIDE_ALL);
     $this->assertEquals(100, $res->getWidth());
     $this->assertEquals(100, $res->getHeight());
     $this->assertRGBAt($res, 5, 5, array('red' => 255, 'green' => 255, 'blue' => 255, 'alpha' => 127));
     $this->assertRGBAt($res, 95, 5, array('red' => 255, 'green' => 255, 'blue' => 255, 'alpha' => 127));
     $this->assertRGBAt($res, 95, 95, array('red' => 255, 'green' => 255, 'blue' => 255, 'alpha' => 127));
     $this->assertRGBAt($res, 5, 95, array('red' => 255, 'green' => 255, 'blue' => 255, 'alpha' => 127));
 }
 public function testPreserveTransparency()
 {
     $img = WideImage::load(IMG_PATH . '100x100-color-hole.gif');
     $this->assertTrue($img->isTransparent());
     $this->assertRGBEqual($img->getTransparentColorRGB(), 255, 255, 255);
     $tc = $img->asTrueColor();
     $this->assertTrue($tc->isTransparent());
     $this->assertRGBEqual($tc->getTransparentColorRGB(), 255, 255, 255);
     $img = $tc->asPalette();
     $this->assertTrue($img->isTransparent());
     $this->assertRGBEqual($img->getTransparentColorRGB(), 255, 255, 255);
 }
 function testResizeCanvasPositionsCorner()
 {
     $img = WideImage::createTrueColorImage(20, 20);
     $black = $img->allocateColor(0, 0, 0);
     $white = $img->allocateColor(255, 255, 255);
     $img->fill(0, 0, $black);
     $res = $img->resizeCanvas(40, 40, 'bottom', 'right', $white);
     $this->assertRGBAt($res, 5, 5, $white);
     $this->assertRGBAt($res, 35, 35, $black);
     $this->assertRGBAt($res, 5, 35, $white);
     $this->assertRGBAt($res, 35, 5, $white);
 }
 public function testPNGAlpha()
 {
     $img = WideImage::load(IMG_PATH . '100x100-blue-alpha.png');
     $gray = $img->asGrayscale();
     $this->assertTrue($gray instanceof WideImage_TrueColorImage);
     $this->assertEquals(100, $gray->getWidth());
     $this->assertEquals(100, $gray->getHeight());
     $this->assertRGBNear($gray->getRGBAt(25, 25), 29, 29, 29, 32);
     $this->assertRGBNear($gray->getRGBAt(75, 25), 29, 29, 29, 64);
     $this->assertRGBNear($gray->getRGBAt(75, 75), 29, 29, 29, 96);
     $this->assertRGBNear($gray->getRGBAt(25, 75), 0, 0, 0, 127);
     $this->assertFalse($gray->isTransparent());
 }
Exemple #26
0
 /**
  * (non-PHPdoc).
  *
  * @see WideImage_Image#asTrueColor()
  */
 public function asTrueColor()
 {
     $width = $this->getWidth();
     $height = $this->getHeight();
     $new = WideImage::createTrueColorImage($width, $height);
     if ($this->isTransparent()) {
         $new->copyTransparencyFrom($this);
     }
     if (!imagecopy($new->getHandle(), $this->handle, 0, 0, 0, 0, $width, $height)) {
         throw new WideImage_GDFunctionResultException('imagecopy() returned false');
     }
     return $new;
 }
Exemple #27
0
 function testApplyMask()
 {
     $img = WideImage::load(IMG_PATH . '100x100-color-hole.gif');
     $mask = WideImage::load(IMG_PATH . '75x25-gray.png');
     $result = $img->applyMask($mask);
     $this->assertTrue($result instanceof WideImage_TrueColorImage);
     $this->assertTrue($result->isTransparent());
     $this->assertEquals(100, $result->getWidth());
     $this->assertEquals(100, $result->getHeight());
     $this->assertRGBNear($result->getRGBAt(10, 10), 255, 255, 255);
     $this->assertRGBNear($result->getRGBAt(30, 10), 255, 255, 0, 64);
     $this->assertRGBNear($result->getRGBAt(60, 10), 0, 0, 255, 0);
 }
Exemple #28
0
 public function resize()
 {
     foreach ($this->data as $dt) {
         $x = $dt['x'];
         $y = $dt['y'];
         $w = $dt['w'];
         $h = $dt['h'];
         $img = WideImage::load($dt['origem']);
         $img->resize($dt['resizeH'], $dt['resizeW'], "outside");
         $img = $img->saveToFile($dt['destino']);
     }
     unset($this->data);
 }
 function testGetMaskPNGAlpha()
 {
     $img = WideImage::load(IMG_PATH . '100x100-blue-alpha.png');
     $mask = $img->getMask();
     $this->assertTrue($mask instanceof WideImage_TrueColorImage);
     $this->assertFalse($mask->isTransparent());
     $this->assertEquals(100, $mask->getWidth());
     $this->assertEquals(100, $mask->getHeight());
     $this->assertRGBNear($mask->getRGBAt(25, 25), 192, 192, 192);
     $this->assertRGBNear($mask->getRGBAt(75, 25), 128, 128, 128);
     $this->assertRGBNear($mask->getRGBAt(75, 75), 64, 64, 64);
     $this->assertRGBNear($mask->getRGBAt(25, 75), 0, 0, 0);
 }
 public function image($one, $two = -1)
 {
     if ($two == -1) {
         $DestinationDirectory = 'assets/uploads/authors-images/';
         $image_name = $DestinationDirectory . 'author-' . $one . '.jpg';
         WideImage::load($image_name)->output('jpg', 90);
     } else {
         $array = explode("_", $one);
         $DestinationDirectory = 'assets/uploads/authors-images/';
         $image_name = $DestinationDirectory . 'author-' . $two . '.jpg';
         list($originalWidth, $originalHeight) = getimagesize($image_name);
         $newWidth = $array[1];
         $newHeight = $originalHeight / $originalWidth * $newWidth;
         WideImage::load($image_name)->resize($newWidth, $newHeight)->output('jpg', 90);
     }
 }