Working with Images

Working with Images

The Neoreef platform has some interesting ways that it can work with images.

File Locations & Shortcuts

Typically, like all files on the platform, they are accessed from within a website's "Site Documents" directory found at "/Documents and Settings/n/Site Documents /MyFolder/MyImageName.jpg ". This is the real physical directory where the file is stored. This is also rather long. For this reason, we also have virtual paths to files and images, by which you can forego the first half of the path ending with "Site Documents". For example, "/Documents and Settings/n/Site Documents /MyFolder/MyImageName.jpg " becomes just " /MyFolder/MyImageName.jpg ". This also works for "Site Settings" as well.

Image Resizing & Cropping

Every file request undergoes some security and route handling before it leaves the server. Images also have the ability to undergo some additional processing as well that can generate virtual image files.

For example, say you need the same image in three different sizes, and three different aspect ratios and three different formats. You can do this easily from one file by using file path supplementation.

Below you will see three paths, the first is the original, next is the same image, but it's virtual path, next is a resized and cropped PNG version of the original.
  1. #Original
  2. /Documents and Settings/n/Site Documents/MyFolder/MyImageName.jpg

  3. #Virtual
  4. /MyFolder/MyImageName.jpg

  5. #Path Supplemented
  6. /Documents and Settings/n/Site Documents/MyFolder/MyImageName.jpg/w/400/h/300/r/1/AnotherImage.png

  7. #Virtual Path Supplemented
  8. /MyFolder/MyImageName.jpg/w/400/h/300/r/1/AnotherImage.png

All manipulations of images are handled in the path following the original image path and file name. You can see available options below:

Anchor position a integer

Valid values are:

  • Top = 0
  • Center = 1
  • Bottom = 2
  • Left = 3
  • Right = 4
Background color b hex Valid values are #000000-#FFFFFF
Format extension *.* string

Valid values are:

  • JPEG - *.jpg
  • GIF - *.gif
  • PNG - *.png
Image Height h integer Valid values are from 1-4000 and are in pixels.
Image Quality q double Valid values are from 1-100 as a percentage.
Image Scale s double Valid values are from 1-999 as a percentage.
Image Width w integer Valid values are from 1-4000 and are in pixels.
Resizing method r integer

Valid values are:

  • None =  0

  • CropToArea =  1

  • ScaleToFitArea =  2

  • ScaleToPercent =  3

  • ScaleToSize =  4

Creation & Caching

The first time an image is requested using path supplementation, an actual image is created and cached on the server for performance. The platform regularly purges these files when either it deems it old and unaccessed, or when internal cache thresholds are exceeded.