From 41d98a7d47d56e0d41812b23cfffc104e45acbad Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Fri, 9 Sep 2022 15:37:34 +0000 Subject: [PATCH] Lower resolution image preview --- app/format/create_thumbnail.php | 20 ++++ app/image/image.php | 4 + app/image/upload_image.php | 169 ++++++++++++++------------- .env => app/settings/.env | 0 {Gallery => app/settings}/GetEnv.php | 0 css/main.css | 22 ++++ css/scss/_body.scss | 31 +++++ image.php | 28 ++++- 8 files changed, 190 insertions(+), 84 deletions(-) create mode 100644 app/format/create_thumbnail.php rename .env => app/settings/.env (100%) rename {Gallery => app/settings}/GetEnv.php (100%) diff --git a/app/format/create_thumbnail.php b/app/format/create_thumbnail.php new file mode 100644 index 0000000..92debfc --- /dev/null +++ b/app/format/create_thumbnail.php @@ -0,0 +1,20 @@ +resizeImage($resolution,null,null,1,null); + $thumbnail->writeImage($thumbnail_path); + + return "success"; + } catch (Exception $e) { + return $e; + } +} \ No newline at end of file diff --git a/app/image/image.php b/app/image/image.php index 26eda47..557b83d 100644 --- a/app/image/image.php +++ b/app/image/image.php @@ -40,6 +40,10 @@ if (isset($_POST['submit_delete'])) { if (is_file("../../images/thumbnails/".$image_array['imagename'])) { unlink("../../images/thumbnails/".$image_array['imagename']); } + // Delete preview if exitsts + if (is_file("../../images/previews/".$image_array['imagename'])) { + unlink("../../images/previews/".$image_array['imagename']); + } // TP user to the homepage with a success message ?> - 300) { + $make_thumbnail = make_thumbnail($image_path, $thumb_dir.$image_newname, 300); + if ($make_thumbnail != "success") { + ?> + + 1000) { + $make_preview = make_thumbnail($image_path, $preview_dir.$image_newname, 1000); + if ($make_preview != "success") { + ?> + + - - - - - - - - - - + + + + + + + + + + -
- ' src='' alt=''> -
+ if (is_file("images/previews/".$image['imagename'])) { + echo "
+ ".$image_alt." + +
"; + ?> + + + ".$image_alt." + "; + } + -