CMS  Version 3.9
ImageGalleryScanManager Class Reference

Public Member Functions

 __construct ($gallery)
 
 rescan ()
 

Public Attributes

 $gallery
 
 $indexedImages = array()
 

Detailed Description

Definition at line 1183 of file image_manager.inc.

Constructor & Destructor Documentation

◆ __construct()

ImageGalleryScanManager::__construct (   $gallery)

Definition at line 1188 of file image_manager.inc.

1189  {
1190  $this->gallery = $gallery;
1191 
1192  $images = $this->gallery->Images();
1193  if(count($images))
1194  {
1195  $this->indexedImages = reindexList($images, "image_file");
1196  }
1197  else
1198  {
1199  $this->indexedImages = array();
1200  }
1201  }
$images
Definition: images.inc:46

Member Function Documentation

◆ rescan()

ImageGalleryScanManager::rescan ( )

Definition at line 1203 of file image_manager.inc.

1204  {
1205  global $user;
1206 
1207  $base = sanitizePath($this->gallery->getGalleryDirectory());
1208 
1209  $files = scandir($base);
1210  foreach($files as $file)
1211  {
1212  if ($file == "." || $file == "..") continue;
1213 
1214  if ($this->indexedImages[$file]) continue;
1215 
1216  $image = new ImageRecord();
1217  $image->title = $file;
1218  $image->image_file = $file;
1219  $image->ALT_tag = "";
1220  $image->published = true;
1221  $image->gallery_id = $this->gallery->gallery_id;
1222  $image->owner_id= $user->get($user->getPrimaryKey());
1223  $image->save();
1224  }
1225  }
$image
Definition: image_form.inc:46
$file
Definition: delete.inc:47
$base
Definition: delete.inc:45
global $user

Member Data Documentation

◆ $gallery

ImageGalleryScanManager::$gallery

Definition at line 1185 of file image_manager.inc.

◆ $indexedImages

ImageGalleryScanManager::$indexedImages = array()

Definition at line 1186 of file image_manager.inc.


The documentation for this class was generated from the following file: