예제 #1
0
 /**
  * Adds tokens depending on sizing configuration.
  *
  * @param array &$tokens
  */
 function add_url_tokens(&$tokens)
 {
     if ($this->max_crop == 0) {
         $tokens[] = 's' . size_to_url($this->ideal_size);
     } elseif ($this->max_crop == 1 && size_equals($this->ideal_size, $this->min_size)) {
         $tokens[] = 'e' . size_to_url($this->ideal_size);
     } else {
         $tokens[] = size_to_url($this->ideal_size);
         $tokens[] = fraction_to_char($this->max_crop);
         $tokens[] = size_to_url($this->min_size);
     }
 }
예제 #2
0
// | USA.                                                                  |
// +-----------------------------------------------------------------------+
if (!defined("PHPWG_ROOT_PATH")) {
    die('Hacking attempt!');
}
// +-----------------------------------------------------------------------+
// | Check Access and exit when user status is not ok                      |
// +-----------------------------------------------------------------------+
check_status(ACCESS_ADMINISTRATOR);
check_input_parameter('image_id', $_GET, false, PATTERN_ID);
if (isset($_POST['submit'])) {
    $query = 'UPDATE ' . IMAGES_TABLE;
    if (strlen($_POST['l']) == 0) {
        $query .= ' SET coi=NULL';
    } else {
        $coi = fraction_to_char($_POST['l']) . fraction_to_char($_POST['t']) . fraction_to_char($_POST['r']) . fraction_to_char($_POST['b']);
        $query .= ' SET coi=\'' . $coi . '\'';
    }
    $query .= ' WHERE id=' . $_GET['image_id'];
    pwg_query($query);
}
$query = 'SELECT * FROM ' . IMAGES_TABLE . ' WHERE id=' . $_GET['image_id'];
$row = pwg_db_fetch_assoc(pwg_query($query));
if (isset($_POST['submit'])) {
    foreach (ImageStdParams::get_defined_type_map() as $params) {
        if ($params->sizing->max_crop != 0) {
            delete_element_derivatives($row, $params->type);
        }
    }
    delete_element_derivatives($row, IMG_CUSTOM);
    $uid = '&b=' . time();