PHP : binary image data, checking the image type

前端 未结 7 1580
刺人心
刺人心 2020-11-30 02:44

I have some images in bin, I want to check the header to check the format (jpg, png, etc)

I don\'t want to use temp files! I have a solution using TEMP FILES.

7条回答
  •  天命终不由人
    2020-11-30 03:22

    Why not just check the file entension? :)

    An Alternative

    if(exif_imagetype($filepath) == IMAGETYPE_JPEG){
        echo 'This is a JPEG image';
    }
    

提交回复
热议问题