Switch language

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




wp_load_image [ WordPress Function ]

wp_load_image ( $file )
Parameters:
  • (string) $file Filename of the image to load.
Returns:
  • (resource) The resulting image resource on success, Error string on failure.
Defined at:



Load an image from a string, if PHP supports it.

Source


<?php
function wp_load_image$file ) {
    if ( 
is_numeric$file ) )
        
$file get_attached_file$file );

    if ( ! 
file_exists$file ) )
        return 
sprintf(__('File &#8220;%s&#8221; doesn&#8217;t exist?'), $file);

    if ( ! 
function_exists('imagecreatefromstring') )
        return 
__('The GD image library is not installed.');

    
// Set artificially high because GD uses uncompressed images in memory
    
@ini_set'memory_limit'apply_filters'image_memory_limit'WP_MAX_MEMORY_LIMIT ) );
    
$image imagecreatefromstringfile_get_contents$file ) );

    if ( !
is_resource$image ) )
        return 
sprintf(__('File &#8220;%s&#8221; is not an image.'), $file);

    return 
$image;
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



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