YaWK  24.1
Yet another WebKit
YAWK\PLUGINS\GALLERY\gallery Class Reference

The Gallery Plugin Class. Help you building powerful image galleries nearly automatically. More...

Public Member Functions

 __construct ()
 define JS function doImageAction gallery constructor. More...
 
 checkDir ($folder)
 check if folder exists and create it on demand More...
 
 drawFolderSelect ($lang, $path)
 draw (output) html folder select field, containing the sub folders of /media/images as value More...
 
 drawFolderSelectFromGallery ($path, $folder)
 draw (output) html folder select field, containing the current folder of /media/images as value More...
 
 scanFonts ($path)
 scan system font directory for fonts and return fonts as select field option value More...
 
 scanImageDirectory ($path)
 scan image directory and return images as select field option value More...
 

Public Attributes

 $action
 
 $author
 
 $authorUrl
 
 $createThumbnails
 
 $description
 
 $filename
 
 $folder
 
 $headline
 
 $id
 
 $imageHeight
 
 $imageWidth
 
 $itemAuthor
 
 $itemAuthorUrl
 
 $itemID
 
 $itemTitle
 
 $offsetX
 
 $offsetY
 
 $resizeImages
 
 $resizeType
 
 $sort
 
 $thumbnailWidth
 
 $title
 
 $watermark
 
 $watermarkBorder
 
 $watermarkBorderColor
 
 $watermarkColor
 
 $watermarkEnabled
 
 $watermarkFont
 
 $watermarkImage
 
 $watermarkOpacity
 
 $watermarkPosition
 
 $watermarkTextSize
 

Detailed Description

The Gallery Plugin Class. Help you building powerful image galleries nearly automatically.

Gallery Plugin

Whenever you build a website, sooner or later you will get to the point where you need to put a few photos within a lightbox on your page. YaWK's gallery plugin help you out! It can build image galleries automatically. It does a perfect batch job adding a watermark to every image or resize images and much more. To add a new gallery, just place all your images in any folder and put that folder fia ftp to /media/images/{yourfolder}. If you don't like to use ftp, you could also use yawk's built-in file manager to upload your files. Once the upload is complete, go back to the gallery plugin and select your uploaded folder. (Or any other folder that is stored under /media/images) Set some settings and you're ready to go. When the gallery is created, load the gallery widget into any layout position you like, select which gallery to show up and you are done.

Basic Features:

  • put a text watermark onto all your images
  • change color and style of your watermark text
  • use any custom .ttf font (must be in /system/fonts)
  • or watermark images overlaying any transparent image (eg. your logo as .png)
  • watermark placement at bottom, middle or top, left or right with any margin
  • change the size of your images
  • flip horizontal or vertical
  • rotate around 90 degrees
  • fit to width
  • fit to height
  • fit to thumbnail
  • auto create thumbnails with the size of your need


Image Manipulation: irrespective from all of that, you can easy overview all images on a page and adjust

  • brightness
  • contrast
  • sharpen
  • blur
  • magic flatten
  • sepia and much more with just a few clicks!

Try it out - this is a really biiiig time-saver! In most cases you don't need to open all images in photoshop. (or something else) Think about it: you don't need to open, edit and save every single image for each - Yet another WebKit's Gallery Plugin is here to do that automatically for you - you just need to set a few parameters, do a single click... - and everything will get set-up as you wish.

Class covers backend functionality only. See Methods Summary for Details!

Author
Daniel Retzl danie.nosp@m.lret.nosp@m.zl@gm.nosp@m.ail..nosp@m.com
Version
1.0.0/
Since
File available since Release 1.0.0

Definition at line 49 of file gallery.php.

Constructor & Destructor Documentation

◆ __construct()

YAWK\PLUGINS\GALLERY\gallery::__construct ( )

define JS function doImageAction gallery constructor.

Definition at line 120 of file gallery.php.

121  {
122  echo "<script type=\"text/javascript\">
123  function doImageAction(action, id, folder, filename, itemID, createThumbnails, thumbnailWidth, watermark, watermarkImage, watermarkOpacity, watermarkPosition, offsetX, offsetY, watermarkFont, watermarkTextSize, watermarkColor, watermarkBorderColor, watermarkBorder)
124  {
125  $.ajax({
126  url:'../system/plugins/gallery/js/actions.php',
127  type:'post',
128  data:'action='+action+'&id='+id+'&folder='+folder+'&filename='+filename+'&itemID='+itemID+'&createThumbnails='+createThumbnails+'&thumbnailWidth='+thumbnailWidth+'&watermark='+watermark+'&watermarkImage='+watermarkImage+'&watermarkOpacity='+watermarkOpacity+'&watermarkPosition='+watermarkPosition+'&offsetX='+offsetX+'&offsetY='+offsetY+'&watermarkFont='+watermarkFont+'&watermarkTextSize='+watermarkTextSize+'&watermarkColor='+watermarkColor+'&watermarkBorderColor='+watermarkBorderColor+'&watermarkBorder='+watermarkBorder,
129  dataType: 'json',
130  // dataType: 'json',
131  success: function(data)
132  {
133  // alert(data.status);
134  var status = data.status;
135  var action = data.action;
136  if(status == 'delete')
137  { // delete successful, reload page afterwards to update gallery view
138  // console.log( data );
139  $('#imgCol-'+itemID).hide();
140  $('#toolset-'+itemID).hide();
141  return true;
142  // location.reload();
143  }
144  if(status == 'true')
145  { // after any other action, reload that image to see changes
146  $('#img-'+itemID).hide().removeAttr('src').attr('src', '../'+folder+'/'+filename+'?'+Math.random()).show();
147  return true;
148  }
149  if(status == 'false')
150  { // could not manipulate image
151  alert('Sorry, the action '+action+'could not be done.');
152  return false;
153  }
154  else
155  { // any other error
156  alert('Sorry, undefined error executing '+action+'. Maybe there is a problem with your image folders, files or permissions.');
157  return false;
158  }
159  }
160  });
161  }
162  </script>";
163  }

Member Function Documentation

◆ checkDir()

YAWK\PLUGINS\GALLERY\gallery::checkDir (   $folder)

check if folder exists and create it on demand

Parameters
string$folderaffected folder
Returns
bool

Definition at line 196 of file gallery.php.

197  { // check if directory exists
198  if (!is_dir("$folder/")) { // folder does not exist, create it
199  if (mkdir("$folder/")) { // folder created,
200  return true;
201  } else { // could not create folder
202  return false;
203  }
204  } else { // directory exists
205  return true;
206  }
207  }

◆ drawFolderSelect()

YAWK\PLUGINS\GALLERY\gallery::drawFolderSelect (   $lang,
  $path 
)

draw (output) html folder select field, containing the sub folders of /media/images as value

Parameters
array$langlanguage array
string$pathusually media/images/

Definition at line 170 of file gallery.php.

171  {
172  echo "<select name=\"folder\" class=\"form-control\" id=\"folder\">
173  <option value=\"\">$lang[SELECT_FOLDER]</option>
174  " . self::scanImageDirectory($path) . "
175  </select>";
176  }
scanImageDirectory($path)
scan image directory and return images as select field option value
Definition: gallery.php:238

References YAWK\PLUGINS\GALLERY\gallery\scanImageDirectory().

◆ drawFolderSelectFromGallery()

YAWK\PLUGINS\GALLERY\gallery::drawFolderSelectFromGallery (   $path,
  $folder 
)

draw (output) html folder select field, containing the current folder of /media/images as value

Parameters
string$pathusually media/images/
string$folderthe folder of this gallery

Definition at line 183 of file gallery.php.

184  {
185  echo "<select name=\"folder\" class=\"form-control\" id=\"folder\">
186  <option value=\"$folder\">$folder</option>
187  " . self::scanImageDirectory($path) . "
188  </select>";
189  }

References YAWK\PLUGINS\GALLERY\gallery\scanImageDirectory().

◆ scanFonts()

YAWK\PLUGINS\GALLERY\gallery::scanFonts (   $path)

scan system font directory for fonts and return fonts as select field option value

Parameters
string$paththe path to search for fonts. If its empty, the default folder will be ../system/fonts/
Returns
string oprion value containing all fonts from font directory

Definition at line 215 of file gallery.php.

216  {
217  $html = '';
218  if (!isset($path)) {
219  $path = "../system/fonts/"; // '.' for current
220  }
221  foreach (new \DirectoryIterator("$path") as $file) {
222  if ($file->isDot()) continue;
223  if ($file->isDir()) continue;
224  if ($file->getExtension() === "ttf") {
225  // print $file->getFilename() . '<br>';
226  $html .= "<option value=\"$path" . $file->getFilename() . "\">system/fonts/" . $file->getFilename() . "</option>";
227  }
228 
229  }
230  return $html;
231  }

◆ scanImageDirectory()

YAWK\PLUGINS\GALLERY\gallery::scanImageDirectory (   $path)

scan image directory and return images as select field option value

Parameters
string$pathusually media/images/
Returns
string option value containing all fonts from font directory

Definition at line 238 of file gallery.php.

239  {
240  $html = '';
241  if (!isset($path)) {
242  $path = "media/images/"; // '.' for current
243  }
244  foreach (new \DirectoryIterator("../$path") as $file) {
245  if ($file->isDot()) continue;
246  if ($file->isDir()) {
247  // print $file->getFilename() . '<br>';
248  $html .= "<option value=\"$path" . $file->getFilename() . "\">images/" . $file->getFilename() . "</option>";
249  }
250  }
251  return $html;
252  }

Referenced by YAWK\PLUGINS\GALLERY\gallery\drawFolderSelect(), and YAWK\PLUGINS\GALLERY\gallery\drawFolderSelectFromGallery().

Member Data Documentation

◆ $action

YAWK\PLUGINS\GALLERY\gallery::$action
  • Parameters
    stringimage manipulation action (eg. flip-horizontal)

Definition at line 58 of file gallery.php.

◆ $author

YAWK\PLUGINS\GALLERY\gallery::$author
  • Parameters
    stringimages author (originator, photographer)

Definition at line 68 of file gallery.php.

◆ $authorUrl

YAWK\PLUGINS\GALLERY\gallery::$authorUrl
  • Parameters
    stringimages author's url (originator, photographer)

Definition at line 70 of file gallery.php.

◆ $createThumbnails

YAWK\PLUGINS\GALLERY\gallery::$createThumbnails
  • Parameters
    int0|1 switch: 1 if thumbnails should be created, zero if not.

Definition at line 78 of file gallery.php.

◆ $description

YAWK\PLUGINS\GALLERY\gallery::$description
  • Parameters
    stringgallery description

Definition at line 66 of file gallery.php.

◆ $filename

YAWK\PLUGINS\GALLERY\gallery::$filename
  • Parameters
    stringimage filename

Definition at line 76 of file gallery.php.

◆ $folder

YAWK\PLUGINS\GALLERY\gallery::$folder
  • Parameters
    stringimages folder

Definition at line 60 of file gallery.php.

◆ $headline

YAWK\PLUGINS\GALLERY\gallery::$headline
  • Parameters
    stringheadline

Definition at line 114 of file gallery.php.

◆ $id

YAWK\PLUGINS\GALLERY\gallery::$id
  • Parameters
    intgallery ID

Definition at line 52 of file gallery.php.

◆ $imageHeight

YAWK\PLUGINS\GALLERY\gallery::$imageHeight
  • Parameters
    intimage height in px

Definition at line 82 of file gallery.php.

◆ $imageWidth

YAWK\PLUGINS\GALLERY\gallery::$imageWidth
  • Parameters
    intimage width in px

Definition at line 80 of file gallery.php.

◆ $itemAuthor

YAWK\PLUGINS\GALLERY\gallery::$itemAuthor
  • Parameters
    stringsingle image author (originator, photographer)

Definition at line 72 of file gallery.php.

◆ $itemAuthorUrl

YAWK\PLUGINS\GALLERY\gallery::$itemAuthorUrl
  • Parameters
    stringsingle image author's url (originator, photographer)

Definition at line 74 of file gallery.php.

◆ $itemID

YAWK\PLUGINS\GALLERY\gallery::$itemID
  • Parameters
    intitem ID

Definition at line 54 of file gallery.php.

◆ $itemTitle

YAWK\PLUGINS\GALLERY\gallery::$itemTitle
  • Parameters
    stringitem title

Definition at line 64 of file gallery.php.

◆ $offsetX

YAWK\PLUGINS\GALLERY\gallery::$offsetX
  • Parameters
    intoffset X in px

Definition at line 100 of file gallery.php.

◆ $offsetY

YAWK\PLUGINS\GALLERY\gallery::$offsetY
  • Parameters
    intoffset Y in px

Definition at line 98 of file gallery.php.

◆ $resizeImages

YAWK\PLUGINS\GALLERY\gallery::$resizeImages
  • Parameters
    int0|1 switch: 1 if images should be resized, zero if not

Definition at line 84 of file gallery.php.

◆ $resizeType

YAWK\PLUGINS\GALLERY\gallery::$resizeType
  • Parameters
    stringtype of resizing (eg. thumbnail or fit to width...)

Definition at line 86 of file gallery.php.

◆ $sort

YAWK\PLUGINS\GALLERY\gallery::$sort
  • Parameters
    intorder sortation number

Definition at line 56 of file gallery.php.

◆ $thumbnailWidth

YAWK\PLUGINS\GALLERY\gallery::$thumbnailWidth
  • Parameters
    intthumbnail width in px

Definition at line 88 of file gallery.php.

◆ $title

YAWK\PLUGINS\GALLERY\gallery::$title
  • Parameters
    stringgallery title

Definition at line 62 of file gallery.php.

◆ $watermark

YAWK\PLUGINS\GALLERY\gallery::$watermark
  • Parameters
    stringwatermark text

Definition at line 90 of file gallery.php.

◆ $watermarkBorder

YAWK\PLUGINS\GALLERY\gallery::$watermarkBorder
  • Parameters
    stringwatermark border thickness in px

Definition at line 112 of file gallery.php.

◆ $watermarkBorderColor

YAWK\PLUGINS\GALLERY\gallery::$watermarkBorderColor
  • Parameters
    stringwatermark text border color

Definition at line 110 of file gallery.php.

◆ $watermarkColor

YAWK\PLUGINS\GALLERY\gallery::$watermarkColor
  • Parameters
    stringwatermark text color

Definition at line 108 of file gallery.php.

◆ $watermarkEnabled

YAWK\PLUGINS\GALLERY\gallery::$watermarkEnabled
  • Parameters
    int0|1 switch: 1 if watermark is enabled, zero if not

Definition at line 92 of file gallery.php.

◆ $watermarkFont

YAWK\PLUGINS\GALLERY\gallery::$watermarkFont
  • Parameters
    stringpath and filename of the .ttf font to use for text watermarking

Definition at line 102 of file gallery.php.

◆ $watermarkImage

YAWK\PLUGINS\GALLERY\gallery::$watermarkImage
  • Parameters
    stringthe image which should be overlayed for watermarking

Definition at line 94 of file gallery.php.

◆ $watermarkOpacity

YAWK\PLUGINS\GALLERY\gallery::$watermarkOpacity
  • Parameters
    intwatermark opacity

Definition at line 106 of file gallery.php.

◆ $watermarkPosition

YAWK\PLUGINS\GALLERY\gallery::$watermarkPosition
  • Parameters
    stringwatermark position

Definition at line 96 of file gallery.php.

◆ $watermarkTextSize

YAWK\PLUGINS\GALLERY\gallery::$watermarkTextSize
  • Parameters
    intwatermark text size in pt

Definition at line 104 of file gallery.php.


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