function image_update_7005

Add a column to the 'image_style' table to store administrative labels.

Related topics

File

modules/image/image.install, line 461

Code

function image_update_7005() {
    $field = array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The style administrative name.',
    );
    db_add_field('image_styles', 'label', $field);
    // Do a direct query here, rather than calling image_styles(),
    // in case Image module is disabled.
    $styles = db_query('SELECT name FROM {image_styles}')->fetchCol();
    foreach ($styles as $style) {
        db_update('image_styles')->fields(array(
            'label' => $style,
        ))
            ->condition('name', $style)
            ->execute();
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.