You are here

function amazons3_image_load in AmazonS3 7.2

Load an image, exiting if it could not be loaded.

Parameters

string $uri: The image URI to load.

Return value

\stdClass The loaded image.

3 calls to amazons3_image_load()
amazons3_image_deliver in ./amazons3.module
Image delivery callback that uploads a derivative to S3.
_amazons3_generate_image_style in ./amazons3.module
Generate an image style derivative and upload it to S3.
_amazons3_image_wait_transfer in ./amazons3.module
Wait for an image to appear in a directory, and transfer it when it appears.

File

./amazons3.module, line 301
Hook implementations for the AmazonS3 module.

Code

function amazons3_image_load($uri) {
  $image = image_load($uri);
  if (!$image) {
    watchdog('amazons3', 'Unable to generate the derived image located at %path.', array(
      '%path' => $uri,
    ));
    drupal_add_http_header('Status', '500 Internal Server Error');
    drupal_add_http_header('Content-Type', 'text/html; charset=utf-8');
    print t('Error generating image.');
    drupal_exit();
  }
  return $image;
}