• File: FlipCommand.php
  • Full Path: /home/masbinta/public_html/core/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FlipCommand.php
  • File size: 628 bytes
  • MIME-type: text/x-php
  • Charset: utf-8
<?php

namespace Intervention\Image\Imagick\Commands;

use Intervention\Image\Commands\AbstractCommand;

class FlipCommand extends AbstractCommand
{
    /**
     * Mirrors an image
     *
     * @param  \Intervention\Image\Image $image
     * @return boolean
     */
    public function execute($image)
    {
        $mode = $this->argument(0)->value('h');

        if (in_array(strtolower($mode), [2, 'v', 'vert', 'vertical'])) {
            // flip vertical
            return $image->getCore()->flipImage();
        } else {
            // flip horizontal
            return $image->getCore()->flopImage();
        }
    }
}