You are here

function return_presets in Image javascript crop 5

Same name and namespace in other branches
  1. 6 imagecrop.module \return_presets()

Helper function to determine which preset exists and which to load

Parameters

$presetid id of preset:

Return value

$presets array with presetid to load and list of all other possible presets

2 calls to return_presets()
imagecrop_docrop in ./imagecrop.module
Callback with javascript crop.
imagecrop_showcrop in ./imagecrop.module
Show the cropped image.

File

./imagecrop.module, line 439
Provides a javascript toolbox through an imagecache action.

Code

function return_presets($presetid) {
  $result = db_query("SELECT ip.presetid, ip.presetname FROM {imagecache_preset} ip INNER JOIN {imagecache_action} ia on ia.presetid = ip.presetid WHERE action = 'imagecrop_javascript' ORDER by ip.presetname ASC");
  while ($row = db_fetch_object($result)) {
    $presets['tabs'][] = array(
      'id' => $row->presetid,
      'name' => $row->presetname,
    );
  }
  if (!empty($presetid)) {
    $presets['presetid'] = $presetid;
  }
  else {
    $presets['presetid'] = $presets['tabs'][0]['id'];
  }
  return $presets;
}