SiGal  1.7
Simple gallery script provides single-file web gallery.
Public Member Functions | Public Attributes | List of all members
Sigal Class Reference

Simple gallery script provides single-file web gallery. More...

Public Member Functions

 __construct ()
 Actually only redefines $this->html_head and $this->html_tail. More...
 
 addAccess ()
 Adds string $user.':'.$pass to array $_SESSION['givenaccess']. The values are obtained from $_POST['fuser'] and $_POST['fpass'].
 
 basepathname ($path)
 remove root dir from path
 
 getparentdir ($path)
 get parent dir in hierarchy for correct upper navigation
 
 urlpathencode ($path)
 encode path for url query argument. urlencode without slash encoding
 
 showGallery ($albtop=NULL)
 Shows complete gallery - the albums selection.
 
 showAlbum ($alb)
 Shows given album. More...
 
 showImage ($f)
 Shows detail of given photo. More...
 
 showVideo ($f)
 Shows video. More...
 
 showPassForm ()
 Shows form for grant access.
 
 showCreditPage ()
 Shows credit page.
 
 getAlbums ($top=NULL)
 Get sorted (by name reversed eg. 9->0, Z->A) array of all albums. More...
 
 readLock ($dir)
 Reads possible lock file and parse its contents into current object.
 
 getImages ($dir)
 Returns all images from given directory sorted by name and read possible locks of album. More...
 
 getAlbumTitleFile ($album)
 Gets path to title image of given album. If there are no iconificable image, the $this->defaultIcon is used. More...
 
 downloadZippedImages ()
 
 makeThumbImage ($file)
 Creates thumbnail of given image. More...
 
 makeMiddleImage ($file)
 Creates middle size image of given original image. More...
 
 resizeImage ($path, $max_x)
 Resizes given image (JPG, PNG, GIF, BMP) with respect to aspect ratio. Saves final image to cache. More...
 
 cookie ($name, $value, $lifetime=2592000)
 
 lang ($idf, $number=null)
 
 format_number ($val)
 
 detect_lang ()
 
 switch_lang ()
 
 remove_from_uri ($param="")
 

Public Attributes

 $version = '1.7.0'
 
 $dir = 'pictures'
 
 $cache = 'cache'
 
 $defaultIcon = '?static=defico.png'
 
 $defaultDirIcon = '?static=defdirico.svg'
 
 $icotitlefname = '000.nfo'
 
 $lockfname = '000.lock'
 
 $thumb_x = 320
 
 $thumb_y = 240
 
 $middle_x = 800
 
 $imgTitleLen = 24
 
 $date_format = 'Y-m-d'
 
 $galTitle = 'SiGal gallery'
 
 $legal_notice = 'No photos can be distributted without written permission of their author.'
 
 $enable_mass_download = true
 
 $show_exif_tab = true
 
 $show_gps_tab = true
 
 $cache_image_quality = 80
 
 $exts = array('jpg','jpeg','png','gif','bmp','tif','tiff','svg','swf','flv','mp4', 'mp3','mts','mov')
 
 $extsIcon = array('jpg','jpeg','png', 'gif', 'bmp')
 
 $extsExif = array('jpg','jpeg','tif','tiff')
 
 $extsVideo = array('swf','flv','mp4','mts','mov')
 
 $extsAudio = array('mp3')
 
 $defaultMime = 'text/plain'
 
 $avMime
 
 $func_sortimages = NULL
 
 $func_sortalbums = NULL
 
 $func_scandir = NULL
 
 $func_albumname = NULL
 
 $func_groupname = NULL
 
 $func_sortgroups = NULL
 
 $langs
 
 $LANG = 'en'
 
 $html_head
 
 $html_tail = ''
 

Detailed Description

Simple gallery script provides single-file web gallery.

Constructor & Destructor Documentation

◆ __construct()

Sigal::__construct ( )

Actually only redefines $this->html_head and $this->html_tail.

Returns
An instance of SiGal class.

Member Function Documentation

◆ cookie()

Sigal::cookie (   $name,
  $value,
  $lifetime = 2592000 
)

Set cookie valid on current path

Parameters
string$name
string$value
int$lifetimenumber of seconds, 0 for session cookie
Returns
bool

◆ detect_lang()

Sigal::detect_lang ( )
Returns
string 2 chars of language ID (eg.: en | cs | ...)

◆ downloadZippedImages()

Sigal::downloadZippedImages ( )
Returns
zipped binary data

◆ format_number()

Sigal::format_number (   $val)

Format decimal number

Parameters
int$val
Returns
string

◆ getAlbums()

Sigal::getAlbums (   $top = NULL)

Get sorted (by name reversed eg. 9->0, Z->A) array of all albums.

Returns
An array of all albums in defined dir ($this->dir).

◆ getAlbumTitleFile()

Sigal::getAlbumTitleFile (   $album)

Gets path to title image of given album. If there are no iconificable image, the $this->defaultIcon is used.

Parameters
string$albumPath to album directory
Returns
URL of title image.

◆ getImages()

Sigal::getImages (   $dir)

Returns all images from given directory sorted by name and read possible locks of album.

Parameters
string$dirSource directory for scan.
Returns
An array of all images.

◆ lang()

Sigal::lang (   $idf,
  $number = null 
)

Translate string

Parameters
string$idf
int$number
Returns
string

◆ makeMiddleImage()

Sigal::makeMiddleImage (   $file)

Creates middle size image of given original image.

Parameters
string$fileThe original filename.

◆ makeThumbImage()

Sigal::makeThumbImage (   $file)

Creates thumbnail of given image.

Parameters
string$fileThe original filename.

◆ remove_from_uri()

Sigal::remove_from_uri (   $param = "")

Remove parameter from query string

Parameters
string$param
Returns
string

◆ resizeImage()

Sigal::resizeImage (   $path,
  $max_x 
)

Resizes given image (JPG, PNG, GIF, BMP) with respect to aspect ratio. Saves final image to cache.

Parameters
string$pathThe original image..
double$max_xFinal width.
Returns
string Full path of resized image in cache.

◆ showAlbum()

Sigal::showAlbum (   $alb)

Shows given album.

Parameters
string$albFull path to album directory.

◆ showImage()

Sigal::showImage (   $f)

Shows detail of given photo.

Parameters
string$fPath to original image.

◆ showVideo()

Sigal::showVideo (   $f)

Shows video.

Parameters
string$fpath to video.

◆ switch_lang()

Sigal::switch_lang ( )

Prints the form for language switching.

Member Data Documentation

◆ $avMime

Sigal::$avMime
Initial value:
= array(
'mp3' => 'audio/mpeg',
'mp4' => 'video/mp4',
'mts' => 'video/mts',
'mov' => 'video/quicktime',
'swf' => 'application/x-shockwave-flash',
'flv' => 'video/x-flv'
)

Mime types for files. The key represents extension, value is mime type.

◆ $cache

Sigal::$cache = 'cache'

Directory for caching thumbnails (must be writeable!).

◆ $cache_image_quality

Sigal::$cache_image_quality = 80

Quality of output cached jpeg images.

◆ $date_format

Sigal::$date_format = 'Y-m-d'

Date format for image/thumbnail display.

◆ $defaultDirIcon

Sigal::$defaultDirIcon = '?static=defdirico.svg'

URL to default album. May be absolute or relative.

◆ $defaultIcon

Sigal::$defaultIcon = '?static=defico.png'

URL to default picture icon. May be absolute or relative.

◆ $defaultMime

Sigal::$defaultMime = 'text/plain'

Default mime type. It is used when automated recognition fails.

◆ $dir

Sigal::$dir = 'pictures'

Directory with pictures.

◆ $enable_mass_download

Sigal::$enable_mass_download = true

Flag to enable function of mass download.

◆ $exts

Sigal::$exts = array('jpg','jpeg','png','gif','bmp','tif','tiff','svg','swf','flv','mp4', 'mp3','mts','mov')

Array of file extensions for scanning in directiories.

◆ $extsAudio

Sigal::$extsAudio = array('mp3')

Array of file extensions for audio files.

◆ $extsExif

Sigal::$extsExif = array('jpg','jpeg','tif','tiff')

Array of file extensions with EXIF informations.

◆ $extsIcon

Sigal::$extsIcon = array('jpg','jpeg','png', 'gif', 'bmp')

Array of file extensions for which we are able to generate thumbnail.

◆ $extsVideo

Sigal::$extsVideo = array('swf','flv','mp4','mts','mov')

Array of file extensions for videofiles.

◆ $func_albumname

Sigal::$func_albumname = NULL

Callback function for mapping directory name to album name.

◆ $func_groupname

Sigal::$func_groupname = NULL

Callback function for getting album/directory group name

◆ $func_scandir

Sigal::$func_scandir = NULL

Callback function for scanning directory for images. You can implement own filters tanks to this function.

◆ $func_sortalbums

Sigal::$func_sortalbums = NULL

Callback function for sorting albums in gallery.

◆ $func_sortgroups

Sigal::$func_sortgroups = NULL

Callback function for sorting group names.

◆ $func_sortimages

Sigal::$func_sortimages = NULL

Callback function for sorting images in some album.

◆ $galTitle

Sigal::$galTitle = 'SiGal gallery'

Title of whole gallery.

◆ $html_head

Sigal::$html_head

HTML head of each page of gallery. You can use string "{title}" which will be replaced by title of gallery defined above.

◆ $html_tail

Sigal::$html_tail = ''

HTML tail of each page of galllery.

◆ $icotitlefname

Sigal::$icotitlefname = '000.nfo'

Name of file with definition of title image.

◆ $imgTitleLen

Sigal::$imgTitleLen = 24

Number of characters of shortened image title.

◆ $LANG

Sigal::$LANG = 'en'

Default language

◆ $langs

Sigal::$langs
Initial value:
= array(
'en' => 'English',
'cs' => 'Čeština',
)

Available languages

◆ $legal_notice

Sigal::$legal_notice = 'No photos can be distributted without written permission of their author.'

String shown in bottom of each page. Designed to some words about legal use of photos.

◆ $lockfname

Sigal::$lockfname = '000.lock'

Name of file with defined usernames/passwords for locked/private albums.

◆ $middle_x

Sigal::$middle_x = 800

Width of middle size picture - the view size.

◆ $show_exif_tab

Sigal::$show_exif_tab = true

Flag to show EXIF info in image details.

◆ $show_gps_tab

Sigal::$show_gps_tab = true

Flag to show GPS info in image details.

◆ $thumb_x

Sigal::$thumb_x = 320

Width of thumbnail. Minimal 120px.

◆ $thumb_y

Sigal::$thumb_y = 240

Height of thumbnail. Minimal 120px.

◆ $version

Sigal::$version = '1.7.0'

Current version.


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