我正在構建一個與iPad相機配合使用的HTML應用程序,並將拍攝的圖像上傳到我的服務器。 上傳時,圖像通過使用imagecopy()獲取水印。Iphone imagecopy旋轉我的圖像
一切正常,當我在我的電腦上測試它,但由於某種原因,如果我在肖像中拍攝ipad/ipod/iphone上的圖片,水印圖像會旋轉到橫向模式。
澄清:原始圖片上傳正確,水印圖片旋轉。當我在我的電腦上使用肖像圖像嘗試時,不會發生這種情況。
這是一些代碼,如果有幫助的話(我使用Codeigniter框架)。如果您需要更多代碼,只需詢問,但我認爲上傳本身沒有任何問題。
//The code for the imagecopy do add the watermark
$overlay = imagecreatefrompng(base_url() . 'assets/images/imgoverlay.png');
$img = imagecreatefromjpeg(base_url() . 'uploads/' . $config['file_name']);
$imageSize = getimagesize(base_url() . 'uploads/' . $config['file_name']);
$sx = imagesx($overlay);
$sy = imagesy($overlay);
$newWatermarkWidth = $imageSize[0];
$newWatermarkHeight = $sy * $newWatermarkWidth/$sx;
$test = imagecopy(
$img,
$overlay,
$imageSize[0]/2 - $newWatermarkWidth/2,
$imageSize[1] - $newWatermarkHeight,
0,
0,
imagesx($img),imagesy($img)
);
非常感謝!
它將與紐帶,以未修改的iPad的圖像幫助。也可能是您的水印版本。 – haraldK