aboutsummaryrefslogtreecommitdiffstats
path: root/library/blueimp_upload/server/php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-10-22 09:45:20 +0200
committerMario Vavti <mario@mariovavti.com>2018-10-22 09:45:20 +0200
commit71195895ba98f2af86b3739f2992473a587aa099 (patch)
treeeedacaac419bef8dc66fed887d6639a04bad044f /library/blueimp_upload/server/php
parentea850e58d219a756189532bbb3e9ec8d85e9ba6a (diff)
downloadvolse-hubzilla-71195895ba98f2af86b3739f2992473a587aa099.tar.gz
volse-hubzilla-71195895ba98f2af86b3739f2992473a587aa099.tar.bz2
volse-hubzilla-71195895ba98f2af86b3739f2992473a587aa099.zip
update blueimp_upload to version 9.23
Diffstat (limited to 'library/blueimp_upload/server/php')
-rw-r--r--library/blueimp_upload/server/php/Dockerfile2
-rwxr-xr-xlibrary/blueimp_upload/server/php/UploadHandler.php48
-rw-r--r--library/blueimp_upload/server/php/docker-compose.yml15
3 files changed, 43 insertions, 22 deletions
diff --git a/library/blueimp_upload/server/php/Dockerfile b/library/blueimp_upload/server/php/Dockerfile
index ca88d3d0d..8633fee74 100644
--- a/library/blueimp_upload/server/php/Dockerfile
+++ b/library/blueimp_upload/server/php/Dockerfile
@@ -1,4 +1,4 @@
-FROM php:7.0-apache
+FROM php:7-apache
# Enable the Apache Headers module:
RUN ln -s /etc/apache2/mods-available/headers.load \
diff --git a/library/blueimp_upload/server/php/UploadHandler.php b/library/blueimp_upload/server/php/UploadHandler.php
index 1380d4739..285d046aa 100755
--- a/library/blueimp_upload/server/php/UploadHandler.php
+++ b/library/blueimp_upload/server/php/UploadHandler.php
@@ -131,18 +131,22 @@ class UploadHandler
// Command or path for to the ImageMagick identify binary:
'identify_bin' => 'identify',
'image_versions' => array(
- // The empty image version key defines options for the original image:
+ // The empty image version key defines options for the original image.
+ // Keep in mind: these image manipulations are inherited by all other image versions from this point onwards.
+ // Also note that the property 'no_cache' is not inherited, since it's not a manipulation.
'' => array(
// Automatically rotate images based on EXIF meta data:
'auto_orient' => true
),
- // Uncomment the following to create medium sized images:
+ // You can add arrays to generate different versions.
+ // The name of the key is the name of the version (example: 'medium').
+ // the array contains the options to apply.
/*
'medium' => array(
'max_width' => 800,
'max_height' => 600
),
- */
+ */
'thumbnail' => array(
// Uncomment the following to use a defined directory for the thumbnails
// instead of a subdirectory based on the version identifier.
@@ -153,9 +157,13 @@ class UploadHandler
//'upload_url' => $this->get_full_url().'/thumb/',
// Uncomment the following to force the max
// dimensions and e.g. create square thumbnails:
- //'crop' => true,
- 'max_width' => 80,
- 'max_height' => 80
+ // 'auto_orient' => true,
+ // 'crop' => true,
+ // 'jpeg_quality' => 70,
+ // 'no_cache' => true, (there's a caching option, but this remembers thumbnail sizes from a previous action!)
+ // 'strip' => true, (this strips EXIF tags, such as geolocation)
+ 'max_width' => 80, // either specify width, or set to 0. Then width is automatically adjusted - keeping aspect ratio to a specified max_height.
+ 'max_height' => 80 // either specify height, or set to 0. Then height is automatically adjusted - keeping aspect ratio to a specified max_width.
)
),
'print_response' => true
@@ -862,22 +870,32 @@ class UploadHandler
$image_oriented = false;
if (!empty($options['auto_orient'])) {
$image_oriented = $this->imagick_orient_image($image);
- }
+ }
+
+ $image_resize = false;
$new_width = $max_width = $img_width = $image->getImageWidth();
- $new_height = $max_height = $img_height = $image->getImageHeight();
- if (!empty($options['max_width'])) {
- $new_width = $max_width = $options['max_width'];
- }
- if (!empty($options['max_height'])) {
+ $new_height = $max_height = $img_height = $image->getImageHeight();
+
+ // use isset(). User might be setting max_width = 0 (auto in regular resizing). Value 0 would be considered empty when you use empty()
+ if (isset($options['max_width'])) {
+ $image_resize = true;
+ $new_width = $max_width = $options['max_width'];
+ }
+ if (isset($options['max_height'])) {
+ $image_resize = true;
$new_height = $max_height = $options['max_height'];
}
- if (!($image_oriented || $max_width < $img_width || $max_height < $img_height)) {
+
+ $image_strip = (isset($options['strip']) ? $options['strip'] : false);
+
+ if ( !$image_oriented && ($max_width >= $img_width) && ($max_height >= $img_height) && !$image_strip && empty($options["jpeg_quality"]) ) {
if ($file_path !== $new_file_path) {
return copy($file_path, $new_file_path);
}
return true;
}
- $crop = !empty($options['crop']);
+ $crop = (isset($options['crop']) ? $options['crop'] : false);
+
if ($crop) {
$x = 0;
$y = 0;
@@ -917,7 +935,7 @@ class UploadHandler
}
break;
}
- if (!empty($options['strip'])) {
+ if ( $image_strip ) {
$image->stripImage();
}
return $success && $image->writeImage($new_file_path);
diff --git a/library/blueimp_upload/server/php/docker-compose.yml b/library/blueimp_upload/server/php/docker-compose.yml
index 691ea9caa..74eabf7dc 100644
--- a/library/blueimp_upload/server/php/docker-compose.yml
+++ b/library/blueimp_upload/server/php/docker-compose.yml
@@ -1,6 +1,9 @@
-apache:
- build: ./
- ports:
- - "80:80"
- volumes:
- - "../../:/var/www/html"
+version: '2.3'
+services:
+ apache:
+ build: ./
+ network_mode: bridge
+ ports:
+ - "80:80"
+ volumes:
+ - "../../:/var/www/html"