当前位置:   article > 正文

lnmp安装exif扩展

lnmp 安装exif

lnmp安装exif扩展

1.找到位置

cd /usr/local/lnmp1.4-full/src

2.解压php

  1. sudo bzip2 -d php-5.6.31.tar.bz2
  2. sudo tar -xvf php-5.6.31.tar

3.进入php

cd /usr/local/lnmp1.4-full/src/php-5.6.31/ext

4.进入exif

 cd exif && /usr/local/php/bin/phpize 

5.配置

 ./configure --with-php-config=/usr/local/php/bin/php-config

6.安装

sudo make && sudo make install

7.增加配置

cd /usr/local/php/conf.d
sudo vim 008-exif.ini
extension = "exif.so"

8.重启php

service php-fpm restart

9.查看

php -m
  1. $ php -m |grep exif
  2. exif
  1. <?php
  2. $file_arr = read_exif_data('./photo.jpg');
  3. var_dump($file_arr);
  1. array(45) {
  2. ["FileName"]=>
  3. string(9) "photo.jpg"
  4. ["FileDateTime"]=>
  5. int(1533333328)
  6. ["FileSize"]=>
  7. int(7941835)
  8. ["FileType"]=>
  9. int(2)
  10. ["MimeType"]=>
  11. string(10) "image/jpeg"
  12. ["SectionsFound"]=>
  13. string(30) "ANY_TAG, IFD0, THUMBNAIL, EXIF"
  14. ["COMPUTED"]=>
  15. array(8) {
  16. ["html"]=>
  17. string(26) "width="3479" height="4567""
  18. ["Height"]=>
  19. int(4567)
  20. ["Width"]=>
  21. int(3479)
  22. ["IsColor"]=>
  23. int(1)
  24. ["ByteOrderMotorola"]=>
  25. int(0)
  26. ["ApertureFNumber"]=>
  27. string(5) "f/2.8"
  28. ["Thumbnail.FileType"]=>
  29. int(2)
  30. ["Thumbnail.MimeType"]=>
  31. string(10) "image/jpeg"
  32. }
  33. ["Make"]=>
  34. string(5) "Canon"
  35. ["Model"]=>
  36. string(12) "Canon EOS 6D"
  37. ["XResolution"]=>
  38. string(5) "300/1"
  39. ["YResolution"]=>
  40. string(5) "300/1"
  41. ["ResolutionUnit"]=>
  42. int(2)
  43. ["Software"]=>
  44. string(40) "Adobe Photoshop Camera Raw 8.5 (Windows)"
  45. ["DateTime"]=>
  46. string(19) "2018:08:04 11:18:27"
  47. ["Exif_IFD_Pointer"]=>
  48. int(208)
  49. ["THUMBNAIL"]=>
  50. array(6) {
  51. ["Compression"]=>
  52. int(6)
  53. ["XResolution"]=>
  54. string(4) "72/1"
  55. ["YResolution"]=>
  56. string(4) "72/1"
  57. ["ResolutionUnit"]=>
  58. int(2)
  59. ["JPEGInterchangeFormat"]=>
  60. int(844)
  61. ["JPEGInterchangeFormatLength"]=>
  62. int(13311)
  63. }
  64. ["ExposureTime"]=>
  65. string(5) "1/125"
  66. ["FNumber"]=>
  67. string(5) "28/10"
  68. ["ExposureProgram"]=>
  69. int(1)
  70. ["ISOSpeedRatings"]=>
  71. int(160)
  72. ["UndefinedTag:0x8830"]=>
  73. int(2)
  74. ["UndefinedTag:0x8832"]=>
  75. int(160)
  76. ["ExifVersion"]=>
  77. string(4) "0230"
  78. ["DateTimeOriginal"]=>
  79. string(19) "2018:07:15 15:36:12"
  80. ["DateTimeDigitized"]=>
  81. string(19) "2018:07:15 15:36:12"
  82. ["ShutterSpeedValue"]=>
  83. string(15) "6965784/1000000"
  84. ["ApertureValue"]=>
  85. string(15) "2970854/1000000"
  86. ["ExposureBiasValue"]=>
  87. string(3) "0/1"
  88. ["MaxApertureValue"]=>
  89. string(3) "1/1"
  90. ["MeteringMode"]=>
  91. int(2)
  92. ["Flash"]=>
  93. int(16)
  94. ["FocalLength"]=>
  95. string(4) "50/1"
  96. ["SubSecTimeOriginal"]=>
  97. string(2) "11"
  98. ["SubSecTimeDigitized"]=>
  99. string(2) "11"
  100. ["FocalPlaneXResolution"]=>
  101. string(12) "5472000/1436"
  102. ["FocalPlaneYResolution"]=>
  103. string(11) "3648000/956"
  104. ["FocalPlaneResolutionUnit"]=>
  105. int(2)
  106. ["CustomRendered"]=>
  107. int(0)
  108. ["ExposureMode"]=>
  109. int(1)
  110. ["WhiteBalance"]=>
  111. int(1)
  112. ["SceneCaptureType"]=>
  113. int(0)
  114. ["UndefinedTag:0xA431"]=>
  115. string(12) "334021005410"
  116. ["UndefinedTag:0xA432"]=>
  117. array(4) {
  118. [0]=>
  119. string(4) "50/1"
  120. [1]=>
  121. string(4) "50/1"
  122. [2]=>
  123. string(3) "0/0"
  124. [3]=>
  125. string(3) "0/0"
  126. }
  127. ["UndefinedTag:0xA434"]=>
  128. string(16) "EF50mm f/1.4 USM"
  129. ["UndefinedTag:0xA435"]=>
  130. string(10) "0000000000"
  131. }

以下几种方式都可以

  1. $file_arr = read_exif_data('./photo.jpg');
  2. $file_arr = read_exif_data('https://cdn.caomall.net/15344950781428748118.jpg');
  3. $file_arr = read_exif_data($_FILES[$file_name]['tmp_name']);
声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号