(PHP 4 >= 4.3.0, PHP 5, PHP 7)
exif_imagetype — 判断一个图像的类型
1 | IMAGETYPE_GIF |
2 | IMAGETYPE_JPEG |
3 | IMAGETYPE_PNG |
4 | IMAGETYPE_SWF |
5 | IMAGETYPE_PSD |
6 | IMAGETYPE_BMP |
7 |
IMAGETYPE_TIFF_II (Intel 字节顺序) |
8 |
IMAGETYPE_TIFF_MM (Motorola 字节顺序) |
9 | IMAGETYPE_JPC |
10 | IMAGETYPE_JP2 |
11 | IMAGETYPE_JPX |
12 | IMAGETYPE_JB2 |
13 | IMAGETYPE_SWC |
14 | IMAGETYPE_IFF |
15 | IMAGETYPE_WBMP |
16 | IMAGETYPE_XBM |
<?php if (exif_imagetype("image.gif") != IMAGETYPE_GIF) { echo "The picture is not a gif"; } if (in_array(exif_imagetype("path/to/file"), array(IMAGETYPE_GIF , IMAGETYPE_JPEG ,IMAGETYPE_PNG , IMAGETYPE_BMP))) { echo "This is a picture "; } ?>
转自:PHP简单方法判断文件是否是图片 PHP best way to check if file is an image
相关推荐
The syntax of the file is extremely simple. Whitespace and lines ; beginning with a semicolon are silently ignored (as you probably guessed). ; Section headers (e.g. [Foo]) are also silently ignored,...
be an open relay, as authentication is supported, but it is your responsibility to ensure the SMTP server is configured properly. There is nothing in the JavaMail API for tasks like configuring a ...
Reserving memory address space is a way to reserve a range of virtual addresses for later use. If you attempt to access a reserved address that has not yet been committed (backed by memory or disk) ...
build version and service pack info, the windows directory, the PDC name if you are logged onto an NT server and the time <END><br>62 , ccheckduncount.zip If you want to check if there is a RAS/...
If you do any kind <END><br>55,splitfile.zip This project contains several useful and interesting bits of code, but the best thing is a function/routine to split a file into smaller chunks - great...
- Added an IRC log to explain how to use it (Greetings to LaBBa) - Tracers - Error codes updated for the Tracers Level2 and 3 - Plugin Tracer - Redesigned interface for good reasons (See ) - ...
If the table is a heap (in other words, it has no clustered index), the bookmark is a RID, which is an actual row locator in the form File#:Page#:Slot#. Finding Rows with a NC Index on a Heap ...
WinZip® is the most trusted way to work with compressed files. No other compression utility is as easy-to-use or offers the comprehensive and productivity-enhancing approach that has made WinZip the ...
Interestingly the processor architecture plays an important role here as you can see in the performance tests as it is directly related to the sorting key time, the Core iX processors seem to be very ...
The best way to organize your feeds is up to you. == Screenshots == 1. Dashboard 2. Campaigns list 3. Add campaign main tab 4. Add campaign feeds tab 5. Add campaign categories tab 6. Add campaign ...
The most basic use of this function is to pass in an expression (usually consisting of CSS), which then finds all matching elements. By default, if no context is specified, $() looks for DOM ...