function ThumbnailImage($Data, $Attributes = False) { if (function_exists('Debug') && Debug()) { Deprecated(__FUNCTION__, 'Thumbnail'); } $Width = ArrayValue('width', $Attributes, ''); $Height = ArrayValue('height', $Attributes, ''); if (Is_Array($Data)) { // group, todo // <ul><li><a></a></li> } $Prefix = substr($Data, 0, 7); //if(In_Array($Prefix, array('http://', 'https:/'))) {} //$bLocalImage = False; if ($Prefix != 'http://') { //$bLocalImage = True; $IncomingImage = $Data; $ImageFindPaths[] = 'uploads' . DS . $Data; $ImageFindPaths[] = $Data; foreach ($ImageFindPaths as $File) { if (file_exists($File) && is_file($File)) { $IncomingImage = $File; break; } } } else { $IncomingImage = $Data; } $CacheDirectory = 'uploads/cached'; if (!is_writable($CacheDirectory)) { mkdir($CacheDirectory, 0777, True); if (!is_writable($CacheDirectory)) { $ErrorMessage = ErrorMessage(sprintf(T('Directory (%s) is not writable.'), $CacheDirectory), 'PHP', __FUNCTION__); trigger_error($ErrorMessage, E_USER_ERROR); return ''; } } $Name = CleanupString(pathinfo($IncomingImage, PATHINFO_FILENAME) . ' ' . $Width . ' ' . $Height); $Extension = FileExtension($IncomingImage); $Target = $CacheDirectory . DS . $Name . '.' . $Extension; if (!file_exists($Target)) { Gdn_UploadImage::SaveImageAs($IncomingImage, $Target, $Height, $Width); } $Target = str_replace(DS, '/', $Target); if (!array_key_exists('alt', $Attributes)) { $Attributes['alt'] = pathinfo($Name, PATHINFO_FILENAME); } list($Width, $Height, $Type) = GetImageSize($IncomingImage); $Attributes['alt'] .= sprintf(' (%d×%d)', $Width, $Height); $Image = Img($Target, $Attributes); return Anchor($Image, Url($IncomingImage), '', '', True); }
unset($file_keywords[$key]); $key = intval($key); if ($value != "0_1") { $file_keys .= ($file_keys ? ":" : "") . $key . "_" . intval($value); $file_keywords[$key] = intval($value); } else { $file_error["keywords"][$key] = 1; } } } //if(isEmpty($file_shortinfo)) $file_error["shortinfo"] = 1; if (empty($file_name)) { $file_error["name"] = 1; } else { //Wenn Dateiname keine Erweiterung hat, dann Extension anhängen if (trim(strtolower(FileExtension($file_name))) != trim($file_ext)) { $file_name .= "." . $file_ext; } } //Eintragen der aktualisierten Verzeichnisinfos if (!isset($file_error)) { $sql = "UPDATE " . DB_PREPEND . "phpwcms_file SET " . "f_name='" . aporeplace($file_name) . "', " . "f_pid=" . $file_pid . ", " . "f_aktiv=" . $file_aktiv . ", " . "f_public=" . $file_public . ", " . "f_shortinfo='" . aporeplace($file_shortinfo) . "', " . "f_longinfo='" . aporeplace($file_longinfo) . "', " . "f_keywords='" . $file_keys . "', " . "f_created='" . time() . "', " . "f_copyright='" . aporeplace($file_copyright) . "', " . "f_tags='" . aporeplace($file_tags) . "', " . "f_granted=" . $file_granted . ", " . "f_gallerystatus=" . $file_gallerydownload . ", " . (isset($file_vars) ? 'f_vars=' . _dbEscape(serialize($file_vars)) . ',' : '') . "f_sort=" . $file_sort . " " . "WHERE f_kid=1 AND f_id=" . $file_id; if (empty($_SESSION["wcs_user_admin"])) { $sql .= " AND f_uid=" . intval($_SESSION["wcs_user_id"]); } if ($result = mysql_query($sql, $db)) { // store tags _dbSaveCategories($file_tags, 'file', $file_id, ','); //headerRedirect(PHPWCMS_URL."phpwcms.php?do=files&f=0"); } else { $file_error["save_failed"] = 1;