Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -646,7 +646,8 @@ class _Image extends \IPS\Content\Item implements
|
||||
{
|
||||
if( $filter->itemClass == 'IPS\\gallery\\Image' )
|
||||
{
|
||||
$filter->containerClasses = array( 'IPS\\gallery\\Category' );
|
||||
/* container class can be category or album */
|
||||
$filter->containerClasses = array( 'IPS\\gallery\\Category', 'IPS\\gallery\\Album' );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -855,9 +856,9 @@ class _Image extends \IPS\Content\Item implements
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Images on same date
|
||||
* @brief Images that match the current one based on the current sort
|
||||
*/
|
||||
protected $imagesSameDate = NULL;
|
||||
protected $imagesSameSort = NULL;
|
||||
|
||||
/**
|
||||
* Get the next or previous 5 images in the container
|
||||
@@ -874,37 +875,42 @@ class _Image extends \IPS\Content\Item implements
|
||||
if( $this->album_id )
|
||||
{
|
||||
$where[] = array( 'image_album_id=?', $this->album_id );
|
||||
$sortBy = static::$databaseColumnMap[ $this->directContainer()->_sortBy ];
|
||||
}
|
||||
else
|
||||
{
|
||||
$where[] = array( 'image_category_id=?', $this->category_id );
|
||||
$where[] = array( 'image_album_id=?', 0 );
|
||||
$sortBy = static::$databaseColumnMap[ $this->directContainer()->sort_options_img ?: 'updated' ];
|
||||
}
|
||||
|
||||
$where['id'] = array( 'image_id<>?', $this->id );
|
||||
|
||||
$column = $this->getDateColumn();
|
||||
|
||||
if( $this->imagesSameDate === NULL )
|
||||
if( $sortBy == 'caption' )
|
||||
{
|
||||
$where['date'] = array( static::$databasePrefix . $column . '= ?', $this->$column );
|
||||
$this->imagesSameDate = \IPS\Db::i()->select( 'COUNT(*)', 'gallery_images', $where )->first();
|
||||
$direction = ( $direction == 'ASC' ) ? 'DESC' : 'ASC';
|
||||
$dir = ( $dir == '>' ) ? '<' : '>';
|
||||
}
|
||||
|
||||
if( !$this->imagesSameDate )
|
||||
if( $this->imagesSameSort === NULL )
|
||||
{
|
||||
$where['date'] = array( static::$databasePrefix . $column . " {$dir}= ?", $this->$column );
|
||||
return iterator_to_array( \IPS\gallery\Image::getItemsWithPermission( $where, static::$databasePrefix . $column . ' ' . $direction, $count ) );
|
||||
$where['date'] = array( static::$databasePrefix . $sortBy . '= ?', $this->$sortBy );
|
||||
$this->imagesSameSort = \IPS\Db::i()->select( 'COUNT(*)', 'gallery_images', $where )->first();
|
||||
}
|
||||
|
||||
if( !$this->imagesSameSort )
|
||||
{
|
||||
$where['date'] = array( static::$databasePrefix . $sortBy . " {$dir}= ?", $this->$sortBy );
|
||||
return iterator_to_array( \IPS\gallery\Image::getItemsWithPermission( $where, static::$databasePrefix . $sortBy . ' ' . $direction . ', image_id ' . $direction, $count ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$where['date'] = array( static::$databasePrefix . $column . '= ?', $this->$column );
|
||||
unset( $where['id'] );
|
||||
|
||||
$results = array();
|
||||
$seen = FALSE;
|
||||
|
||||
foreach( \IPS\gallery\Image::getItemsWithPermission( $where, static::$databasePrefix . $column . ' ' . $direction, NULL ) as $image )
|
||||
foreach( \IPS\gallery\Image::getItemsWithPermission( $where, static::$databasePrefix . $sortBy . ' ' . $direction . ', image_id ' . $direction, NULL ) as $image )
|
||||
{
|
||||
if( !$seen )
|
||||
{
|
||||
@@ -926,8 +932,8 @@ class _Image extends \IPS\Content\Item implements
|
||||
|
||||
if( count( $results ) < $count )
|
||||
{
|
||||
$where['date'] = array( static::$databasePrefix . $column . " {$dir} ?", $this->$column );
|
||||
$results = array_merge( $results, iterator_to_array( \IPS\gallery\Image::getItemsWithPermission( $where, static::$databasePrefix . $column . ' ' . $direction, $count - count( $results ) ) ) );
|
||||
$where['date'] = array( static::$databasePrefix . $sortBy . " {$dir} ?", $this->$sortBy );
|
||||
$results = array_merge( $results, iterator_to_array( \IPS\gallery\Image::getItemsWithPermission( $where, static::$databasePrefix . $sortBy . ' ' . $direction, $count - count( $results ) ) ) );
|
||||
}
|
||||
|
||||
return $results;
|
||||
@@ -1371,6 +1377,12 @@ class _Image extends \IPS\Content\Item implements
|
||||
*/
|
||||
public function deleteThumbnails()
|
||||
{
|
||||
/* We don't delete thumbnails for videos */
|
||||
if( $this->media )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach( array( 'masked_file_name', 'small_file_name' ) as $size )
|
||||
{
|
||||
if( isset( $this->_data[ $size ] ) AND $this->$size AND $this->$size != $this->original_file_name )
|
||||
|
||||
Reference in new issue
Block a user