Version 4.7.13
This commit is contained in:
1 parent
fd22d99e69
commit
7124a02564
954 files changed
+29277
-59308
No files matched your search
@@ -244,7 +244,8 @@ class _Upload extends FormAbstract
|
||||
|
||||
/* If there is an error, an exception will be thrown and will be caught below like normal */
|
||||
\IPS\File::validateUpload( $fileArray, $this->options['allowedFileTypes'], $this->options['maxFileSize'] );
|
||||
|
||||
|
||||
$exif = NULL;
|
||||
if ( $fileObj->isImage() )
|
||||
{
|
||||
try
|
||||
@@ -254,6 +255,7 @@ class _Upload extends FormAbstract
|
||||
if( $image::exifSupported() )
|
||||
{
|
||||
$image->setExifData( $fileObj->contents() );
|
||||
$exif = $image->parseExif();
|
||||
}
|
||||
|
||||
$hasBeenResized = $image->resizeToMax( $this->options['image']['maxWidth'] ?? NULL, $this->options['image']['maxHeight'] ?? NULL );
|
||||
@@ -266,16 +268,17 @@ class _Upload extends FormAbstract
|
||||
}
|
||||
catch ( \Exception $e ) { }
|
||||
}
|
||||
|
||||
|
||||
$insertId = \IPS\Db::i()->insert( 'core_files_temp', array(
|
||||
'upload_key' => md5( $this->name . session_id() ),
|
||||
'filename' => $fileObj->originalFilename,
|
||||
'mime' => \IPS\File::getMimeType( $fileObj->originalFilename ),
|
||||
'contents' => (string) $fileObj,
|
||||
'time' => time(),
|
||||
'storage_extension' => $this->options['storageExtension']
|
||||
'storage_extension' => $this->options['storageExtension'],
|
||||
'exif' => $exif ? json_encode( $exif ) : NULL
|
||||
) );
|
||||
|
||||
|
||||
if ( $this->options['callback'] )
|
||||
{
|
||||
$callbackFunction = $this->options['callback'];
|
||||
@@ -466,7 +469,7 @@ class _Upload extends FormAbstract
|
||||
|
||||
/* The html() method is called more than once, however $this->value is wiped out so if it was an attachments array all of the array properties are lost */
|
||||
$templateFunction = $this->template;
|
||||
$this->builtHtml = $templateFunction( $this->name, $this->value, $this->options['minimize'], $maxFileSize, $this->options['maxFiles'], $this->maxChunkSize, $this->options['totalMaxSize'], $this->options['allowedFileTypes'], $uploadKey, $this->options['multiple'], $this->options['postKey'], $this->options['temporary'] or ( isset( \IPS\Request::i()->cookie['vle_editor'] ) and \IPS\Request::i()->cookie['vle_editor'] ), $this->options['template'], $existing, $this->options['default'], $this->options['supportsDelete'], $maxImageDims, $this->options['allowStockPhotos'] );
|
||||
$this->builtHtml = $templateFunction( $this->name, $this->value, $this->options['minimize'], $maxFileSize, $this->options['maxFiles'], $this->maxChunkSize, $this->options['totalMaxSize'], $this->options['allowedFileTypes'], $uploadKey, $this->options['multiple'], $this->options['postKey'], $this->options['temporary'] or ( \IPS\Lang::vleActive() ), $this->options['template'], $existing, $this->options['default'], $this->options['supportsDelete'], $maxImageDims, $this->options['allowStockPhotos'] );
|
||||
return $this->builtHtml;
|
||||
}
|
||||
|
||||
@@ -721,8 +724,9 @@ class _Upload extends FormAbstract
|
||||
{
|
||||
$options = $this->options;
|
||||
$canBeModerated = $options['canBeModerated'];
|
||||
$exifData = array();
|
||||
|
||||
$fileObjects = \IPS\File::createFromUploads( $this->options['storageExtension'], $fieldName, $this->options['allowedFileTypes'], $this->options['maxFileSize'], $this->options['totalMaxSize'], 0, function( $contents, $filename, $i ) use ( $options, &$requiresModeration, $canBeModerated )
|
||||
$fileObjects = \IPS\File::createFromUploads( $this->options['storageExtension'], $fieldName, $this->options['allowedFileTypes'], $this->options['maxFileSize'], $this->options['totalMaxSize'], 0, function( $contents, $filename, $i ) use ( $options, &$requiresModeration, $canBeModerated, &$exifData )
|
||||
{
|
||||
$ext = mb_strtolower( mb_substr( $filename, mb_strrpos( $filename, '.' ) + 1 ) );
|
||||
|
||||
@@ -740,6 +744,7 @@ class _Upload extends FormAbstract
|
||||
/* If type JPG, image handler may strip meta data on image output */
|
||||
if( $hasBeenResized OR $image->hasBeenRotated OR $image->type == 'jpeg' )
|
||||
{
|
||||
$exifData[ $i ] = $image->parseExif();
|
||||
$contents = (string) $image;
|
||||
}
|
||||
}
|
||||
@@ -748,14 +753,14 @@ class _Upload extends FormAbstract
|
||||
|
||||
return $contents;
|
||||
}, $this->options['storageContainer'], $this->options['obscure'] );
|
||||
|
||||
|
||||
foreach ( $fileObjects as $i => $fileObj )
|
||||
{
|
||||
$exif = NULL;
|
||||
|
||||
if( \IPS\Image::exifSupported() and $fileObj->isImage() and $fileObj->exifData )
|
||||
if( isset( $exifData[ $i ] ) AND $fileExifData = $exifData[ $i ] OR ( \IPS\Image::exifSupported() and $fileObj->isImage() and $fileExifData = $fileObj->exifData ) )
|
||||
{
|
||||
$exif = json_encode( $fileObj->exifData );
|
||||
$exif = json_encode( $fileExifData );
|
||||
}
|
||||
|
||||
$data = $this->populateTempData( array(
|
||||
|
||||
Reference in new issue
Block a user