public function imageFlip($params)
    {
        if (is_array($params)) {
            $filename = $params['source'];
            $ext = $this->imageExtension($filename);
            if ($ext === 'png') {
                $image = imagecreatefromstring(file_get_contents($filename));
            } elseif ($ext === 'jpeg') {
                $image = imagecreatefromjpeg($filename);
            } elseif ($ext === 'gif') {
                $image = imagecreatefromgif($filename);
            } else {
                return false;
            }
            if ($params['flip'] === 'horizontal') {
                imageflip($image, IMG_FLIP_HORIZONTAL);
            } elseif ($params['flip'] === 'vertical') {
                imageflip($image, IMG_FLIP_VERTICAL);
            } else {
                imageflip($image, IMG_FLIP_BOTH);
            }
            imagejpeg($image);
            if (isset($params['save']) and $params['save'] === true) {
                $this->imageSave([
                    'image'  => $image,
                    'target' => $params['target'], ]);
            }
        } else {
            return false;
        }
    }
public function imageFlip($params)
    {
        if (is_array($params)) {
            $filename = $params['source'];
            $ext = $this->imageExtension($filename);
            if ($ext === 'png') {
                $image = imagecreatefromstring(file_get_contents($filename));
            } elseif ($ext === 'jpeg') {
                $image = imagecreatefromjpeg($filename);
            } elseif ($ext === 'gif') {
                $image = imagecreatefromgif($filename);
            } else {
                return false;
            }
            if ($params['flip'] === 'horizontal') {
                imageflip($image, IMG_FLIP_HORIZONTAL);
            } elseif ($params['flip'] === 'vertical') {
                imageflip($image, IMG_FLIP_VERTICAL);
            } else {
                imageflip($image, IMG_FLIP_BOTH);
            }
            imagejpeg($image);
            if (isset($params['save']) and $params['save'] === true) {
                $this->imageSave([
                    'image'  => $image,
                    'target' => $params['target'], ]);
            }
        } else {
            return false;
        }
    }
public function imageFlip ( $ params ) { if ( is_array ( $ params ) ) { $ filename = $ params [ 'source' ] ; $ ext = $ this -> imageExtension ( $ filename ) ; if ( $ ext === 'png' ) { $ image = imagecreatefromstring ( file_get_contents ( $ filename ) ) ; } elseif ( $ ext === 'jpeg' ) { $ image = imagecreatefromjpeg ( $ filename ) ; } elseif ( $ ext === 'gif' ) { $ image = imagecreatefromgif ( $ filename ) ; } else { return false ; } if ( $ params [ 'flip' ] === 'horizontal' ) { imageflip ( $ image , IMG_FLIP_HORIZONTAL ) ; } elseif ( $ params [ 'flip' ] === 'vertical' ) { imageflip ( $ image , IMG_FLIP_VERTICAL ) ; } else { imageflip ( $ image , IMG_FLIP_BOTH ) ; } imagejpeg ( $ image ) ; if ( isset ( $ params [ 'save' ] ) and $ params [ 'save' ] === true ) { $ this -> imageSave ( [ 'image' => $ image , 'target' => $ params [ 'target' ] , ] ) ; } } else { return false ; } }
Flip the image.

@param   $params (array)
'source' => Source valid image file
'flip' => support two different value
'horizontal' => flip image horizontally
'vertical' => flip image vertically
if you do not want save image these parameter are optional if you want save image
'save' => true
'target' => target + new name of file

@since 1.0.0

@return image
Flip the image .