/** * Flip the current image. */ public function flip() { try { $this->_imagick->flipImage(); } catch (ImagickException $e) { throw new Horde_Image_Exception($e); } }
/** * Vertical mirroring * * @return bool|PEAR_Error TRUE or a PEAR_Error object on error * @access public */ function flip() { try { $this->imagick->flipImage(); } catch (ImagickException $e) { return $this->raiseError('Could not flip the image.', IMAGE_TRANSFORM_ERROR_FAILED); } return true; }
/** * {@inheritdoc} * * @return ImageInterface */ public function flipVertically() { try { $this->imagick->flipImage(); } catch (\ImagickException $e) { throw new RuntimeException('Vertical flip operation failed', $e->getCode(), $e); } return $this; }
/** * {@inheritdoc} */ public function flip($direction = Image::FLIP_HORIZONTAL) { if ($direction === Image::FLIP_VERTICAL) { // Flips the image in the vertical direction $this->image->flipImage(); } else { // Flips the image in the horizontal direction $this->image->flopImage(); } }
public function flip($flipX = false, $flipY = false) { if ($flipX) { $this->image->flopImage(); } if ($flipY) { $this->image->flipImage(); } return $this; }
/** * @param $mode * @return $this|Adapter */ public function mirror($mode) { $this->preModify(); if ($mode == "vertical") { $this->resource->flipImage(); } elseif ($mode == "horizontal") { $this->resource->flopImage(); } $this->postModify(); return $this; }
/** * Flips current image. * * @since 3.5.0 * @access public * * @param boolean $horz Flip along Horizontal Axis * @param boolean $vert Flip along Vertical Axis * @returns true|WP_Error */ public function flip( $horz, $vert ) { try { if ( $horz ) $this->image->flipImage(); if ( $vert ) $this->image->flopImage(); } catch ( Exception $e ) { return new WP_Error( 'image_flip_error', $e->getMessage() ); } return true; }
public function flip($horizontal = true) { // Flip try { if ($horizontal) { $return = $this->_resource->flopImage(); } else { $return = $this->_resource->flipImage(); } } catch (ImagickException $e) { throw new Engine_Image_Adapter_Exception(sprintf('Unable to flip image: %s', $e->getMessage()), $e->getCode()); } return $this; }
public function flip($newFile, $mode) { $imagick = new Imagick(); $imagick->readImage($this->_file); switch ($mode) { case Tomato_Image_Abstract::FLIP_VERTICAL: $imagick->flipImage(); break; case Tomato_Image_Abstract::FLIP_HORIZONTAL: $imagick->flopImage(); break; } $imagick->writeImage($newFile); $imagick->clear(); $imagick->destroy(); }
public function process(\Imagick $image) { $info = getimagesize($this->_file); if ($info['mime'] != 'image/jpeg') { return $image; } if (!($exif_data = exif_read_data($this->_file))) { return $image; } if (isset($exif_data['Orientation'])) { $ort = $exif_data['Orientation']; if ($ort > 1) { switch ($ort) { case 2: $image->flopImage(); break; case 3: $image->rotateImage(new \ImagickPixel(), 180); break; case 4: $image->flipImage(); break; case 5: $image->flopImage(); $image->rotateImage(new \ImagickPixel(), 270); break; case 6: $image->rotateImage(new \ImagickPixel(), 90); break; case 7: $image->flopImage(); $image->rotateImage(new \ImagickPixel(), 90); break; case 8: $image->rotateImage(new \ImagickPixel(), 270); break; } } } return $image; }
public function flip($flip_x = false, $flip_y = false) { if ($flip_x) { if ($this->multiframe()) { foreach ($this->image as $frame) { $frame->flopImage(); } } else { $this->image->flopImage(); } } if ($flip_y) { if ($this->multiframe()) { foreach ($this->image as $frame) { $frame->flipImage(); } } else { $this->image->flipImage(); } } return $this; }
} else { print "Possible file upload attack!\n"; } $s3 = new Aws\S3\S3Client(['version' => 'latest', 'region' => 'us-east-1']); $bucket = uniqid("S3-Sukanya-", false); //print "Creating bucket named {$bucket}\n"; $result = $s3->createBucket(['ACL' => 'public-read', 'Bucket' => $bucket]); $result = $s3->waitUntil('BucketExists', array('Bucket' => $bucket)); //echo "bucket creation done"; $result = $s3->putObject(['ACL' => 'public-read', 'Bucket' => $bucket, 'Key' => "uploads" . $uploadfile, 'ContentType' => $_FILES['userfile']['type'], 'Body' => fopen($uploadfile, 'r+')]); $url = $result['ObjectURL']; //adding expiration to bucket $objectrule = $s3->putBucketLifecycleConfiguration(['Bucket' => $bucket, 'LifecycleConfiguration' => ['Rules' => [['Expiration' => ['Days' => 1], 'NoncurrentVersionExpiration' => ['NoncurrentDays' => 1], 'Prefix' => ' ', 'Status' => 'Enabled']]]]); // reference http://php.net/manual/en/imagick.writeimage.php $filepath = new Imagick($uploadfile); $filepath->flipImage(); mkdir("/tmp/Imagick"); $extension = end(explode('.', $filename)); echo "extension here"; echo $extension; $path = '/tmp/Imagick/'; $imgid = uniqid("DesImage"); $imgloc = $imgid . '.' . $extension; $DestPath = $path . $imgloc; echo $DestPath; ///tmp/Imagick/DesImage56553cb459719.png //$filepath->setImageFormat ("png"); //file_put_contents ($DestPath, $filepath); $filepath->writeImage($DestPath); //bucket creation of flip image $flipbucket = uniqid("flippedimage", false);
/** * Corrects orientation of an image * @param \Imagick $im */ private function correctOrientation(\Imagick &$im) { switch ($im->getImageOrientation()) { case \Imagick::ORIENTATION_TOPRIGHT: $im->flipImage(); break; case \Imagick::ORIENTATION_BOTTOMRIGHT: $im->rotateImage(new \ImagickPixel("none"), 180); break; case \Imagick::ORIENTATION_BOTTOMLEFT: $im->rotateImage(new \ImagickPixel("none"), 180); $im->flipImage(); break; case \Imagick::ORIENTATION_LEFTTOP: $im->rotateImage(new \ImagickPixel("none"), 90); $im->flipImage(); break; case \Imagick::ORIENTATION_RIGHTTOP: $im->rotateImage(new \ImagickPixel("none"), 90); break; case \Imagick::ORIENTATION_RIGHTBOTTOM: $im->rotateImage(new \ImagickPixel("none"), -90); $im->flipImage(); break; case \Imagick::ORIENTATION_LEFTBOTTOM: $im->rotateImage(new \ImagickPixel("none"), -90); break; default: } }
/** * Applies a vertical mirror on the image * * @return Imagick */ public function flip() { $this->image->flipImage(); $this->operations[] = 'flip'; return $this; }
/** * 水平翻转(左右翻转)或垂直翻转(上下翻转) * @param Imagick $im * @param string $hv * @return boolean */ private function _rotate(&$im, $hv) { if (self::ROTATE_H == $hv) { // 水平翻转 $boolean = $im->flopImage(); } elseif (self::ROTATE_V == $hv) { // 垂直翻转 $boolean = $im->flipImage(); } else { $this->_error = '参数错误'; $this->_im = null; return false; } if ($boolean) { return true; } else { $this->_error = '翻转失败'; $this->_im = null; return false; } }
protected function imagick_orient_image(\Imagick $image) { $orientation = $image->getImageOrientation(); $background = new \ImagickPixel('none'); switch ($orientation) { case \imagick::ORIENTATION_TOPRIGHT: // 2 $image->flopImage(); // horizontal flop around y-axis break; case \imagick::ORIENTATION_BOTTOMRIGHT: // 3 $image->rotateImage($background, 180); break; case \imagick::ORIENTATION_BOTTOMLEFT: // 4 $image->flipImage(); // vertical flip around x-axis break; case \imagick::ORIENTATION_LEFTTOP: // 5 $image->flopImage(); // horizontal flop around y-axis $image->rotateImage($background, 270); break; case \imagick::ORIENTATION_RIGHTTOP: // 6 $image->rotateImage($background, 90); break; case \imagick::ORIENTATION_RIGHTBOTTOM: // 7 $image->flipImage(); // vertical flip around x-axis $image->rotateImage($background, 270); break; case \imagick::ORIENTATION_LEFTBOTTOM: // 8 $image->rotateImage($background, 270); break; default: return false; } $image->setImageOrientation(\imagick::ORIENTATION_TOPLEFT); // 1 return true; }
<?php $fullUrl = $_GET['fullUrl']; $imagick = new Imagick(__DIR__ . "/{$fullUrl}"); $imagick->flipImage(); header("Content-Type: image/jpg"); echo $imagick->getImageBlob();
/** * Flip * @param string $val * @return bool */ public function flip($val = 'h') { $source = $this->_getTempEditorFullPath(); $picture = new Imagick($source[0]); if ($val == 'h') { $picture->flipImage(); } if ($val == 'v') { $picture->flopImage(); } $picture->writeImage($source[1]); $this->getRawEditorCache(); return true; }
$rds = new Aws\Rds\RdsClient(['version' => 'latest', 'region' => 'us-west-2']); $result = $rds->describeDBInstances(['DBInstanceIdentifier' => 'Project1db']); $endpoint = $result['DBInstances'][0]['Endpoint']['Address']; echo "============\n" . $endpoint . "================"; $link = mysqli_connect($endpoint, "nandini", "nandinipwd", "Project1db") or die("Error " . mysqli_error($link)); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit; } /* Prepared statement, stage 1: prepare */ if (!($stmt = $link->prepare("INSERT INTO Projectrec (uname, email, phone, raws3url, finisheds3url, jpegfilename, state, DateTime) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"))) { echo "Prepare failed: (" . $link->errno . ") " . $link->error; } $path = new Imagick($uploadfile); $path->flipImage(); mkdir("/tmp/Imagick"); #$imagickpath ='/var/www/html/Imagick/'; $ext = end(explode('.', $fname)); echo $ext; $i = '/tmp/Imagick/'; $j = uniqid("DestinationImage"); $k = $j . '.' . $ext; $DestPath = $i . $k; echo $DestPath; $path->writeImage($DestPath); $flipbucket = uniqid("flippedimage", false); echo $flipbucket; # AWS PHP SDK version 3 create bucket $result = $s3->createBucket(['ACL' => 'public-read', 'Bucket' => $flipbucket]); # PHP version 3
protected static function autoRotateImage($image_file, Imagick $imagick) { $orientation = exec(sprintf('exiftool -Orientation -n -S -t %s', escapeshellarg($image_file))); if (!ctype_digit($orientation)) { return; } else { $orientation = intval($orientation); } $rotated = true; switch ($orientation) { case Imagick::ORIENTATION_TOPRIGHT: // Mirror horizontal $imagick->flopImage(); break; case Imagick::ORIENTATION_BOTTOMRIGHT: // Rotate 180 $imagick->rotateImage(new ImagickPixel(), 180); break; case Imagick::ORIENTATION_BOTTOMLEFT: // Mirror vertical $imagick->flipImage(); break; case Imagick::ORIENTATION_LEFTTOP: // Mirror horizontal and rotate 270 CW $imagick->transverseImage(); break; case Imagick::ORIENTATION_RIGHTTOP: // Rotate 90 CW $imagick->rotateImage(new ImagickPixel(), 90); break; case Imagick::ORIENTATION_RIGHTBOTTOM: // Mirror horizontal and rotate 90 CW $imagick->transposeImage(); break; case Imagick::ORIENTATION_LEFTBOTTOM: // Rotate 270 CW $imagick->rotateImage(new ImagickPixel(), 270); break; default: $rotated = false; } return $rotated; }
/** * 垂直翻转 * * @return bool * @author Sauwe */ public function flipV() { if ($this->notValid()) { return false; } try { $im = new Imagick(); $im->readImageBlob($this->_img_data); if ($im->flipImage()) { $this->_img_data = $im->getImageBlob(); return true; } return false; } catch (Exception $e) { $this->_errno = SAE_ErrUnknown; $this->_errmsg = $e->getMessage(); return false; } }