Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




file_is_displayable_image [ WordPress Function ]

file_is_displayable_image ( $path )
Parameters:
  • (string) $path File path to test.
Uses:
Returns:
  • (bool) True if suitable, false if not suitable.
Defined at:



Validate that file is suitable for displaying within a web page.

Source


<?php
function file_is_displayable_image($path) {
    
$info = @getimagesize($path);
    if ( empty(
$info) )
        
$result false;
    elseif ( !
in_array($info[2], array(IMAGETYPE_GIFIMAGETYPE_JPEGIMAGETYPE_PNG)) )    // only gif, jpeg and png images can reliably be displayed
        
$result false;
    else
        
$result true;

    return 
apply_filters('file_is_displayable_image'$result$path);
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics