die; } $save_ext = $params; break; case 'watermark': if (!$params) { break; } $check_size_allowed($params); if (!preg_match('/^[0-9]+$/', $params)) { if (!Settings::isProductionState()) { exit('Error processing params for action "watermark". Example: 1 or main'); } die; } $data = q_assoc_row('SELECT `image`, `image_pos` FROM `cms_img_proc_perms` WHERE `rule` = "&watermark=' . sql_prepare($params) . '" LIMIT 1'); if (!$data || !$data['image'] || !$data['image_pos']) { if (!Settings::isProductionState()) { exit('Error. Incorrect parameters for action "watermark"'); } die; } $image->watermark($data['image'], $data['image_pos']); break; } } FileSystem::mkdir(DIR_CACHE . 'images/' . $path); if (!$image->save(DIR_CACHE . 'images/' . QUERY, $ext, 90) && !Settings::isProductionState()) { dump('Not enough memory to resize and sharpen image "' . $path . $file . '".'); } unset($image);
/** * Get recursive from childe to top parent * @param int $id * @param array $where * @return array */ public function getFlowUp($id, $where = []) { $q = ['pid' => $id]; $res = []; while ($q['pid']) { $res[] = $q = q_assoc_row($this->getSQL($this->columns, '`t`.`id`="' . $q['pid'] . '"' . ($where ? ' AND ' . implode(' AND ', $where) : NULL) . '')); } return array_reverse($res); }