$watermark_changed = $watermark->file != $old_watermark->file || $watermark->xpos != $old_watermark->xpos || $watermark->ypos != $old_watermark->ypos || $watermark->xrepeat != $old_watermark->xrepeat || $watermark->yrepeat != $old_watermark->yrepeat || $watermark->opacity != $old_watermark->opacity; // save the new watermark configuration ImageStdParams::set_watermark($watermark); // do we have to regenerate the derivatives (and which types)? $changed_types = array(); foreach (ImageStdParams::get_defined_type_map() as $type => $params) { $old_use_watermark = $params->use_watermark; ImageStdParams::apply_global($params); $changed = $params->use_watermark != $old_use_watermark; if (!$changed and $params->use_watermark) { $changed = $watermark_changed; } if (!$changed and $params->use_watermark) { // if thresholds change and before/after the threshold is lower than the corresponding derivative side -> some derivatives might switch the watermark $changed |= $watermark->min_size[0] != $old_watermark->min_size[0] and ($watermark->min_size[0] < $params->max_width() or $old_watermark->min_size[0] < $params->max_width()); $changed |= $watermark->min_size[1] != $old_watermark->min_size[1] and ($watermark->min_size[1] < $params->max_height() or $old_watermark->min_size[1] < $params->max_height()); } if ($changed) { $params->last_mod_time = time(); $changed_types[] = $type; } } ImageStdParams::save(); if (count($changed_types)) { clear_derivative_cache($changed_types); } $page['infos'][] = l10n('Your configuration settings are saved'); } else { $template->assign('watermark', $pwatermark); $template->assign('ferrors', $errors); }