Bug, il cherchai à redimmentionner des images quand ça n'en était pas...

This commit is contained in:
Root srvweb 2019-11-19 14:52:51 +01:00
parent 005df67e1f
commit ff4f7461b1
4 changed files with 13 additions and 4 deletions

View file

@ -26,6 +26,14 @@ Make sure the "files" directory is writable
## Changelog
- futur
- Passowrd for access
- drag and drop for upload
- limit by ip+cookies (sqlite) (limit abuse)
- delete after first access
- BUG delete file, but already in storage
- crypt files
- 0.1 (16/10/2019)
- Configure with YAML file
- Submit a file upload service with temporary link (Direct link, force download link, download multiple after zip)

View file

@ -4,6 +4,7 @@ if (!is_readable('./config.yaml')) {
exit('Error: The configuration file is not present, move config.yaml.default to config.yaml');
}
$config = yaml_parse_file('./config.yaml');
@include_once('./header.php');
include('./lib/functions.php');
if (isset($_GET['id'])){
@ -150,7 +151,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'del') {
}
exit();
}
@include_once('./header.php');
?>
<!DOCTYPE html>
<html>
@ -289,7 +290,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'del') {
$linkDownload=$config['baseUrl'].$id.'.zip';
echo '<div class="fileGlobal fileAll file-ext-zip" >';
echo '<div class="file fileAll icone" onclick="location.href=\''.$linkDownload.'\'"><div class="fi fi-zip fi-size-lg"><div class="fi-content">zip</div></div></div>';
echo '<div class="file fileAll name"><a href="'.$linkDownload.'" target="_blank">'._('All').'</a> - <a class="deleteLink" href="'.$config['baseUrl'].'del/'.$id.'/KEYHERE/"><img width="15" src="'.$config['baseUrl'].'/lib/trash.svg" /> '._('Delete all (permanently)').'</a></div>';
echo '<div class="file fileAll name"><a href="'.$linkDownload.'" target="_blank">'._('All').'</a> - <a class="delete deleteLink" href="'.$config['baseUrl'].'del/'.$id.'/KEYHERE/"><img width="15" src="'.$config['baseUrl'].'/lib/trash.svg" /> '._('Delete all (permanently)').'</a></div>';
echo '<div class="file fileAll read input"><a href="'.$config['baseUrl'].$id.'/" target="_blank"><img src="'.$config['baseUrl'].'/lib/eye.svg" /></a> <input class="copy read fileAll" name="read" type="text" value="'.$config['baseUrl'].$id.'/" readonly=""></div>';
echo '<div class="file fileAll dl input"><a href="'.$linkDownload.'" target="_blank"><img src="'.$config['baseUrl'].'/lib/download.svg"</a> /><input class="copy dl fileAll" name="dl" type="text" value="'.$linkDownload.'" readonly=""></div>';
echo '</div>';

View file

@ -153,7 +153,7 @@ $(function () {
$('#resizeForm').hide();
for (var i = 0; i < this.files.length; i++) {
var mime = this.files[i].type;
if (mime.match('^image\/(png|jpeg|gif)$')) {
if (mime.match('^image\/(jpeg|gif)$')) {
$('#resizeForm').show();
}
}

View file

@ -54,7 +54,7 @@ if (!checkMimeTypes($_FILES['file']['type'])) {
} else {
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadDir.'/'.$uploadFile)
&& $_FILES['file']['error'] == 0) {
if (isset($_POST['resize']) && $_POST['resize'] != 0) {
if (isset($_POST['resize']) && $_POST['resize'] != 0 && preg_match('/^image\/(jpeg|gif)$/', $_FILES['file']['type'])) {
@resize_image($uploadDir.'/'.$uploadFile , $uploadDir.'/'.$uploadFile.'.resize' , $_POST['resize'] , $_POST['resize']);
@rename($uploadDir.'/'.$uploadFile.'.resize', $uploadDir.'/'.$uploadFile);
}