You are here

function _textimage_preset_load in Textimage 7.2

Same name and namespace in other branches
  1. 5.2 textimage.module \_textimage_preset_load()
  2. 5 textimage.module \_textimage_preset_load()
  3. 6.2 textimage.module \_textimage_preset_load()

Load a preset by id or name.

Parameters

mixed $preset: preset id or name.

7 calls to _textimage_preset_load()
textimage_build_image in ./textimage.module
Todo.
textimage_ctools_export_load in includes/ctools.inc
Implements hook_ctools_export_load().
textimage_image_from_preset in ./textimage.module
Loads the Textimage preset and generates the GD image resource.
textimage_preset_delete_confirm in ./textimage.admin.inc
Todo.
textimage_preset_edit in ./textimage.admin.inc
Todo.

... See full list

File

./textimage.module, line 640
Provides text to image manipulations.

Code

function _textimage_preset_load($preset) {
  if (is_numeric($preset)) {

    // Load preset by id.
    $preset = db_query('SELECT * FROM {textimage_preset} WHERE pid = :pid', array(
      ':pid' => $preset,
    ))
      ->fetchAssoc();
  }
  else {

    // Load preset by name.
    $preset = db_query("SELECT * FROM {textimage_preset} WHERE name = :name", array(
      ':name' => $preset,
    ))
      ->fetchAssoc();
  }
  if (empty($preset)) {
    return FALSE;
  }
  else {
    $preset['settings'] = unserialize($preset['settings']);
    return $preset;
  }
}