X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2FPhoto.php;h=785601c7e4eb3e15584645f7c9c660fa8d31d3f6;hb=ccc553306905f58b50f58276529a0ffd275f40d8;hp=2f7c990256c392b7f00d083b49075b70f9d332f2;hpb=da3d175be8450e723d27613d99ba35f4ad18545c;p=friendica.git diff --git a/include/Photo.php b/include/Photo.php index 2f7c990256..785601c7e4 100644 --- a/include/Photo.php +++ b/include/Photo.php @@ -345,6 +345,24 @@ class Photo { } public function orient($filename) { + if ($this->is_imagick()) { + // based off comment on http://php.net/manual/en/imagick.getimageorientation.php + $orientation = $this->image->getImageOrientation(); + switch ($orientation) { + case imagick::ORIENTATION_BOTTOMRIGHT: + $this->image->rotateimage("#000", 180); + break; + case imagick::ORIENTATION_RIGHTTOP: + $this->image->rotateimage("#000", 90); + break; + case imagick::ORIENTATION_LEFTBOTTOM: + $this->image->rotateimage("#000", -90); + break; + } + + $this->image->setImageOrientation(imagick::ORIENTATION_TOPLEFT); + return TRUE; + } // based off comment on http://php.net/manual/en/function.imagerotate.php if(!$this->is_valid()) @@ -516,7 +534,12 @@ class Photo { return FALSE; $string = $this->imageString(); + + $a = get_app(); + + $stamp1 = microtime(true); file_put_contents($path, $string); + $a->save_timestamp($stamp1, "file"); } public function imageString() { @@ -767,7 +790,12 @@ function get_photo_info($url) { $filesize = strlen($img_str); $tempfile = tempnam(get_temppath(), "cache"); + + $a = get_app(); + $stamp1 = microtime(true); file_put_contents($tempfile, $img_str); + $a->save_timestamp($stamp1, "file"); + $data = getimagesize($tempfile); unlink($tempfile); @@ -851,7 +879,10 @@ function store_photo($a, $uid, $imagedata = "", $url = "") { return(array()); } elseif (strlen($imagedata) == 0) { logger("Uploading picture from ".$url, LOGGER_DEBUG); + + $stamp1 = microtime(true); $imagedata = @file_get_contents($url); + $a->save_timestamp($stamp1, "file"); } $maximagesize = get_config('system','maximagesize'); @@ -875,7 +906,11 @@ function store_photo($a, $uid, $imagedata = "", $url = "") { */ $tempfile = tempnam(get_temppath(), "cache"); + + $stamp1 = microtime(true); file_put_contents($tempfile, $imagedata); + $a->save_timestamp($stamp1, "file"); + $data = getimagesize($tempfile); if (!isset($data["mime"])) { @@ -978,3 +1013,4 @@ function store_photo($a, $uid, $imagedata = "", $url = "") { return($image); } +