You are here

function simplecrop_crop_load in SimpleCrop 7

Load crop for image by uri.

Parameters

$uri: URI of image.

bool $reset: Indicates whether to reset static cache.

Return value

mixed

6 calls to simplecrop_crop_load()
simplecrop_crop_delete in includes/simplecrop.api.inc
Delete image crop by file ID.
simplecrop_crop_effect_callback in includes/simplecrop.effects.inc
Crops image to a selected area.
simplecrop_crop_save in includes/simplecrop.api.inc
Create/update image crop data.
simplecrop_field_widget_process in includes/simplecrop.field.inc
Element #process callback for the image_image field type.
simplecrop_file_move in ./simplecrop.module
Implements hook_file_move().

... See full list

File

includes/simplecrop.api.inc, line 47
Contains CRUD operations for SimpleCrop module.

Code

function simplecrop_crop_load($uri, $reset = FALSE) {
  $cache =& drupal_static(__FUNCTION__);
  if (!isset($cache[$uri]) || $reset) {
    $cache[$uri] = db_select('simplecrop')
      ->fields('simplecrop')
      ->condition('uri', $uri)
      ->execute()
      ->fetchObject();
    if (!empty($cache[$uri])) {

      // Crop data stores serialized so we have to unserialize it before using.
      $cache[$uri]->data = unserialize($cache[$uri]->data);

      // Invoke hook to indicate that crop object has been loaded.
      module_invoke_all('simplecrop_crop_load', $cache[$uri]);
    }
  }
  return $cache[$uri];
}