I’m not quite sure you’re using the wp_check_filetype()
correctly. I just successfully tried the following to determine if the post thumbnail ext was jpg or not:
$url = wp_get_attachment_url( get_post_thumbnail_id( ) );
$filetype = wp_check_filetype($url);
if ($filetype[ext] == 'jpg') {
echo 'this is gif';
}
else {
echo 'this aint gif';
}
You probably know already but if you ever want to see what the function returns, you can use echo print_r($filetype)
and it will print the returned array and you can dissect how to best use the returned information (sometimes easier than interpreting up the codex!)
Related Posts:
- TImthumb not working for absolute path
- VT-resize (great alternative to timthumb) : Errors cropping (litespeed, centos 6.3)
- Broken thumbnails (sometimes) with TimThumb
- Declare global variable that can be used on other function
- Thumbs and pictures not showing anymore
- get attachment title based on attachment id
- Get Image Description
- Media Upload Folder – how to manage
- Wrong image dimensions in Insert Media after add_image_size()
- PHP Fatal error: Call to undefined function download_url()
- Upload multiple images in a custom metabox
- How can I hide media library images from general users?
- Strange img srcset behaviour
- Images uploading to wrong folder
- set_post_thumbnail_size not cropping featured images, but reducing proportionally
- How to add php to theme to show alt attributes
- Get URLs for All Sizes of Image via Admin Panel
- Rename image during upload using date and time stamp?
- Images in the Twenty Fourteen theme
- Get author ID with attachment ID
- Show Post Excerpt in Image Attachement
- WP 3.4 has missing photo data
- What’s the best “insert all images” plugin?
- Image Quality Thumbnail Compression in WordPress?
- Gutenberg editor get post featured image by id
- How to add image id class?
- Local WordPress installation doesn’t crop images
- wp_get_attachment_url with specific image_size?
- Get meta data from image
- Shortcode for a link and thumbnail
- Bulk edit Gutenberg single images to change from linking to media file to attachment page
- Fuzzy Images in WordPress 4.4
- Grab remote images and update links in existing posts
- Store Snapshot created via wordpress to use with lightbox
- Get image URL after image created from canvas and sent to WP uploads with AJAX
- How can I use cached images in an AJAX response?
- Can’t get images to align with Gutenberg editor
- Searching for any images in media library displays “no media found”
- Resize header image
- Retrieve image from content, assign it as a featured, and then remove it from the content
- Custom Loop, Match Category with Page: How to display post featured image?
- Modifying the HTML Output of Inserted Images
- WP 5.3 Removing Default WordPress Image Sizes
- Include an image within auto the_excerpt?
- Google verification challenge with file location
- Remove height attribute from wp_get_attachment
- How do I retrieve an image’s width and height using Advanced Custom Fields?
- wp get attachment image always gives me thumbnail
- Images are not showing after moving WordPress installation from server to localhost?
- Images are not showing up in “Uploaded to this post”
- A little confused as to what add image size actually does
- Get thumbnail URL :)
- Right click© images: protection
- Cache DB queries result
- Remove “%” from strings in serialized arrays in wp_postmeta
- Images not found after migrating WordPress website
- Adding srcset to an image in ajax
- Error uploading images in wordpress
- Disable Media File Image Link On Mobile Devices
- Set two default featured images
- Automatically generate missing images
- How to insert image path in database to display product image in wp-admin?
- Apply nextgen-gallery lightbox effect [closed]
- How can I externally retrieve a post’s custom sized image
- Page speed error: “serve scaled images”
- View photo album without having to scroll down for each picture
- How can i sorting and display image order by siz in media library?
- x2 images for retina?
- Save media files (images) to database instead of the filesystem
- i want to change URL of WordPress image or rewrite in runtime
- Load url image full size in thumbnail, medium, large size
- After migration, all featured images using accentued characters in their file names are displayed “blanked”
- Adding numbers to an image based on co-ordinates
- A query to substitute images paths in gutenberg (website migration)?
- WP Large Images crash page
- WordPress can’t detect any thumbnails size?
- Remove image border in twentyeleven theme [closed]
- How to display posts with images in fullscreen slider
- What is the best way to handle Ajax image upload on front end?
- 403 Forbidden when accessing image in wordpress
- Why doesn’t WordPress make thumbnails for videos?
- For what does WP generate Thumbnails?
- Images are not shown
- Thumbnail gallery by date and taxonomy
- Adding multiple images on my site – without using plugins [closed]
- Remove the height limit on wordpress 3.4.2
- > added to images link in WordPress
- Image media upload problem in page editing modus?
- Is there a good way to use CMS images with CSS
- Upload image from other server without resize?
- Images will not attach to posts after site migration
- How to access & display images from a post without textual content ( and vice versa) according to best wordpress practices
- Forcing absolute src links in the RSS feed
- where is images/image.jpg?
- Using the on-board image editor for featured images: edits are not being used
- change with CSS the color of an svg background image set with “background-image: url()”
- What type to upload image within theme options?
- WordPress Missing Images
- Display first image’s caption
- The uploaded images are only full-size (original)