我是從我的數據庫中「準備打印」A4紙上照片的金手指形式。 有些照片是以高度爲導向的,例如:800x600 &有些照片是例如600x800。我需要一些PHP腳本,自動旋轉水平照片垂直&垂直照片保持其方向。以CSS格式表示照片的方向
0
A
回答
0
可以使用用PHP imagerotate .. http://www.php.net/manual/fr/function.imagerotate.php
0
你需要的東西是這樣的:
$filename="image.jpg";
// get the width and height from the image
list($width, $height, $type, $attr) = getimagesize($filename);
//if image width is bigger then the height it will execute the following script
if ($width > height){
// Load the image
$source = imagecreatefromjpeg($filename);
// Rotate
$rotate = imagerotate($source, $degrees, 0);
//and save it on your server...
file_put_contents("myNEWimage.jpg",$rotate);
}
你可能會做一些調整和測試。忙於工作atm,所以沒有時間去測試它。
問候
+0
我喜歡這裏:注意:未定義的變量:第70行中的/home/doprava/www/dano/foto.php中的度數 警告:file_put_contents():提供的資源不是/ new/index中的有效流資源73線上的.php – WanderRook
+0
hmm使得$ degree = 90;它輸出的是什麼? –
相關問題
- 1. 風格嵌入式Instagram照片橫向
- 2. 最好的方式向用戶展示他們的照片
- 3. 多張照片表格或單張照片表格?
- 4. CSS:以類似表格的方式分配非表格元素
- 5. 上傳照片到facebook問題。錯誤的照片方向
- 6. Titanium Appcelerator照片庫(顯示基於服務器列表的照片的網格)
- 7. 以PHP格式獲取照片文件擴展名的最佳方式
- 8. iPhone:以突發模式以編程方式拍攝照片
- 9. 以Zend的形式放置照片表單按鈕的圖片
- 10. iOS的圖像,照片,圖像方向
- 11. 確定照片在JavaScript中的方向?
- 12. 以表格格式顯示
- 13. 以矩陣的形式將照片轉換爲照片
- 14. 從iphone照片庫中獲取照片並在表格視圖中顯示
- 15. Facebook,什麼是WebP格式的照片
- 16. 如何使用CSS以自定義格式顯示錶格?
- 17. PHP照片偏振濾鏡類方向?
- 18. Adobe AIR CameraUI照片方向
- 19. 基於設備方向保存照片
- 20. 顯示照片?
- 21. NSItemProvider以像uiimage或alasset的照片格式
- 22. 像表格的照片庫iOS
- 23. Laravel 4:上傳照片的表格
- 24. 在網絡上顯示iPhone照片時尊重EXIF方向
- 25. 以編程方式向UITableViewController添加表格單元格
- 26. 在表格視圖中顯示從相機拍攝的照片
- 27. 顯示個人資料照片而不是指向該照片的鏈接
- 28. Rails prettyPhoto不顯示與jQuery的照片(而是重定向到照片頁面)
- 29. 以表格形式顯示
- 30. 表CSS格式
看到這個:http://stackoverflow.com/questions/3657023/how-to-detect-shot-angle-of-photo-and-auto-rotate-for-website-display-like -desk – Huey