/** * Loads derivative configuration from database or initializes it. */ static function load_from_db() { global $conf; $arr = @unserialize($conf['derivatives']); if (false !== $arr) { self::$type_map = $arr['d']; self::$watermark = @$arr['w']; if (!self::$watermark) { self::$watermark = new WatermarkParams(); } self::$custom = @$arr['c']; if (!self::$custom) { self::$custom = array(); } if (isset($arr['q'])) { self::$quality = $arr['q']; } } else { self::$watermark = new WatermarkParams(); self::$type_map = self::get_default_sizes(); self::save(); } self::build_maps(); }