image_load

  1. drupal
    1. drupal7
Versionen
drupal7 image_load($file, $toolkit = FALSE)

Load an image file and return an image object.

Any changes to the file are not saved until image_save() is called.

see image_save()

Übergabeparameter

$file Path to an image file.

$toolkit An optional, image toolkit name to override the default.

Rückgabewert

An image object or FALSE if there was a problem loading the file. The image object has the following properties:

  • 'source' - The original file path.
  • 'info' - The array of information returned by image_get_info()
  • 'toolkit' - The name of the image toolkit requested when the image was loaded.

Image tookits may add additional properties. The caller is advised not to monkey about with them.

See also

image_get_info()

image_get_available_toolkits()

image_gd_load()

Verwandte Themen

▾ 3 functions call image_load()

file_validate_image_resolution in includes/file.inc
If the file is an image verify that its dimensions are within the specified maximum and minimum dimensions.
ImageToolkitGdTestCase::testManipulations in modules/simpletest/tests/image.test
Since PHP can't visually check that our images have been manipulated properly, build a list of expected color values for each of the corners and the expected height and widths for the final images.
ImageToolkitTestCase::testLoad in modules/simpletest/tests/image.test
Test the image_load() function.

Code

includes/image.inc, line 339

<?php
function image_load($file, $toolkit = FALSE) {
  if (!$toolkit) {
    $toolkit = image_get_toolkit();
  }
  if ($toolkit) {
    $image = new stdClass();
    $image->source = $file;
    $image->info = image_get_info($file);
    $image->toolkit = $toolkit;
    if (image_toolkit_invoke('load', $image)) {
      return $image;
    }
  }
  return FALSE;
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen