#30320 closed defect (bug) (worksforme)
wp_attachment_is_image() return false if extension is Uppercase
Reported by: | netinial | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.0 |
Component: | Media | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description
Although image is correct.
wp_attachment_is_image() return false if extension is Uppercase like : .JPG
Attachments (1)
Change History (4)
#2
@
10 years ago
- Keywords reporter-feedback added
- Resolution set to worksforme
- Status changed from new to closed
The only way I am able to duplicate this is when the post/attachment does not have a valid post_mime_type (jpg,jpeg,jpe,gif,png or import). So depending on how your attachment was imported/inserted would really affect the outcome of the wp_attachment_is_image().
Note: See
TracTickets for help on using
tickets.
I am unable to reproduce this using a file with .PNG as the extension. Additionally, wp_attachment_is_image() uses strtolower() on the extension it finds, so it's lower cased when it does the comparison. However, wp_attachment_is_image() is a little misleading. You have to use the $post_id of the image itself, not the $post_id of the post you embed the image in.