WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#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)

30320-unit-test.patch (1.4 KB) - added by collinsinternet 7 years ago.
Unit test of wp_attachment_is_image().

Download all attachments as: .zip

Change History (4)

#1 @voldemortensen
7 years ago

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.

#2 @collinsinternet
7 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().

@collinsinternet
7 years ago

Unit test of wp_attachment_is_image().

#3 @SergeyBiryukov
7 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.