image_style_flush should be called with an array. (with at least an entry with key = 'name and the value as now is passed as string)

solution 1:

function media_update_7211() {
  image_style_flush(array('name' => 'square_thumbnail'));
  ...
}

Solution 2: to rename an image style you can simply:


$style = image_style_load('square_thumbnail');
if ($style) {
 $style['name'] = 'media_thumbnail';
  image_style_save($style);

image_style_save() will figure out it is a rename and will call image_style_flush().

I tested solution 2 locally and it works.

Comments

devin carlson’s picture

Assigned: Unassigned » devin carlson
Status: Active » Needs review
StatusFileSize
new735 bytes

Nice catch!

A patch to implement solution #2 which seems a bit more robust.

fietserwin’s picture

Thanks for picking this one up.

Code is OK, perhaps update the comment to just mention a renaming of an image style (admins will see it on the update.php page).

devin carlson’s picture

Status: Needs review » Fixed

Committed #1 to 7.x-2.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated issue summary.