Version 4.7.8

This commit is contained in:
Neo committed 2025-12-19 16:10:42 -08:00
1 parent 7b7404e741
commit fd22d99e69
688 files changed
+19814 -10890

No files matched your search

+19 -29
View File
@@ -232,9 +232,7 @@ class _Upload extends FormAbstract
/* If this is the LAST chunk, finish the process */
if ( \IPS\Request::i()->chunk == \IPS\Request::i()->chunks - 1 )
{
$url = $storageClass->chunkFinish( $ref );
$fileObj = \IPS\File::get( $this->options['storageExtension'], $url );
$fileObj = $storageClass->chunkFinish( $ref, $this->options['storageExtension'] );
$fileArray = array(
'error' => NULL,
@@ -247,24 +245,21 @@ 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'] );
if ( $fileObj->isImage() AND ( $this->options['checkImage'] OR \is_array( $this->options['image'] ) ) )
if ( $fileObj->isImage() )
{
try
{
$image = \IPS\Image::create( $fileObj->contents() );
$image = \IPS\Image::create( $fileObj->contents(), $this->options['checkImage'] ?: TRUE );
if( $image::exifSupported() )
{
$image->setExifData( $fileObj->contents() );
}
$hasBeenResized = FALSE;
if( \is_array( $this->options['image'] ) )
{
$hasBeenResized = $image->resizeToMax( $this->options['image']['maxWidth'] ?: NULL, $this->options['image']['maxHeight'] ?: NULL );
}
if ( $hasBeenResized or $image->hasBeenRotated )
$hasBeenResized = $image->resizeToMax( $this->options['image']['maxWidth'] ?? NULL, $this->options['image']['maxHeight'] ?? NULL );
/* If type JPG, image handler may strip meta data on image output */
if( $hasBeenResized OR $image->hasBeenRotated OR $image->type == 'jpeg' )
{
$fileObj->replace( (string) $image );
}
@@ -487,7 +482,7 @@ class _Upload extends FormAbstract
{
/* Get the files we had already */
$return = array();
$tempFiles = iterator_to_array( \IPS\Db::i()->select( 'id,contents,filename,exif,requires_moderation', 'core_files_temp', array( 'upload_key=?', md5( $this->name . session_id() ) ) )->setKeyField('id') );
$tempFiles = iterator_to_array( \IPS\Db::i()->select( 'id,contents,filename,exif,requires_moderation,labels', 'core_files_temp', array( 'upload_key=?', md5( $this->name . session_id() ) ) )->setKeyField('id') );
if ( $this->options['storageExtension'] )
{
$existingName = $this->name . '_existing';
@@ -507,6 +502,7 @@ class _Upload extends FormAbstract
$file->originalFilename = $tempFiles[ $tempId ]['filename'];
$file->exifData = $tempFiles[ $tempId ]['exif'] ? json_decode( $tempFiles[ $tempId ]['exif'], TRUE ) : NULL;
$file->requiresModeration = (bool) $tempFiles[ $tempId ]['requires_moderation'];
$file->labels = $tempFiles[ $tempId ]['labels'];
$return[ $id ] = $file;
}
else
@@ -735,25 +731,19 @@ class _Upload extends FormAbstract
{
/* Resize */
$image = NULL;
$hasBeenResized = FALSE;
if ( \is_array( $options['image'] ) OR $options['checkImage'] )
try
{
try
$image = \IPS\Image::create( $contents, $options['checkImage'] ?: TRUE );
$hasBeenResized = $image->resizeToMax( $options['image']['maxWidth'] ?? NULL, $options['image']['maxHeight'] ?? NULL );
/* If type JPG, image handler may strip meta data on image output */
if( $hasBeenResized OR $image->hasBeenRotated OR $image->type == 'jpeg' )
{
$image = \IPS\Image::create( $contents );
if( \is_array( $options['image'] ) )
{
$hasBeenResized = $image->resizeToMax( $options['image']['maxWidth'] ?: NULL, $options['image']['maxHeight'] ?: NULL );
}
if ( $hasBeenResized or $image->hasBeenRotated )
{
$contents = (string) $image;
}
$contents = (string) $image;
}
catch ( \Exception $e ) {}
}
catch ( \Exception $e ) {}
}
return $contents;