HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

ocPortal Developer's Guide: Images

» Return to Contents



sources/images.php

Global_functions_images.php

Function summary

array _symbol_image_dims (array param)
string _symbol_thumbnail (array param)
integer get_max_image_size ()
tempcode do_image_thumb (URLPATH url, mixed caption, boolean js_tooltip, boolean is_thumbnail_already, integer width, integer height)
URLPATH ensure_thumbnail (URLPATH full_url, URLPATH thumb_url, ID_TEXT thumb_dir, ID_TEXT table, AUTO_LINK id, ID_TEXT thumb_field_name, ?integer thumb_width)
boolean check_memory_limit_for (PATH file_path, boolean exit_on_error)
boolean convert_image (URLPATH from, PATH to, integer width, integer height, integer box_width, boolean exit_on_error, ?string ext2, boolean using_path, boolean only_make_smaller, ?array thumb_options)
float get_gd_version ()
boolean is_image (string name)
boolean is_video (string name, boolean must_be_true_video)
boolean is_saveable_image (string name)

array _symbol_image_dims(array param)

Render an 'IMAGE_WIDTH'/'IMAGE_HEIGHT' symbol.

Parameters…

Name param
Description Symbol parameters
Type array

Returns…

Description A pair: Image dimensions
Type array

Return to the function index for this class Expand: View the source code to this function

string _symbol_thumbnail(array param)

Render a 'THUMBNAIL' symbol.

Parameters…

Name param
Description Symbol parameters
Type array

Returns…

Description Rendered symbol
Type string

Return to the function index for this class Expand: View the source code to this function

integer get_max_image_size()

Get the maximum allowed image size, as set in the configuration.

Parameters…

Returns…

Description The maximum image size
Type integer

Return to the function index for this class Expand: View the source code to this function

tempcode do_image_thumb(URLPATH url, mixed caption, boolean js_tooltip, boolean is_thumbnail_already, integer width, integer height)

Get the tempcode for an image thumbnail.

Parameters…

Name url
Description The URL to the image thumbnail
Type URLPATH

Name caption
Description The caption for the thumbnail (string or Tempcode)
Type mixed

Name js_tooltip
Description Whether to use a JS tooltip. Forcibly set to true if you pass Tempcode
Default value boolean-false
Type boolean

Name is_thumbnail_already
Description Whether already a thumbnail (if not, function will make one)
Default value boolean-true
Type boolean

Name width
Description Thumbnail width to use
Default value 90
Type integer

Name height
Description Thumbnail height to use
Default value 90
Type integer

Returns…

Description The thumbnail
Type tempcode

Return to the function index for this class Expand: View the source code to this function

URLPATH ensure_thumbnail(URLPATH full_url, URLPATH thumb_url, ID_TEXT thumb_dir, ID_TEXT table, AUTO_LINK id, ID_TEXT thumb_field_name, ?integer thumb_width)

Take some image/thumbnail info, and if needed make and caches a thumbnail, and return a thumb url whatever the situation.

Parameters…

Name full_url
Description The full URL to the image which will-be/is thumbnailed
Type URLPATH

Name thumb_url
Description The URL to the thumbnail (blank: no thumbnail yet)
Type URLPATH

Name thumb_dir
Description The directory, relative to the ocPortal install, where the thumbnails are stored. MINUS "_thumbs"
Type ID_TEXT

Name table
Description The name of the table that is storing what we are doing the thumbnail for
Type ID_TEXT

Name id
Description The ID of the table record that is storing what we are doing the thumbnail for
Type AUTO_LINK

Name thumb_field_name
Description The name of the table field where thumbnails are saved
Default value thumb_url
Type ID_TEXT

Name thumb_width
Description The thumbnail width to use (NULL: default)
Default value
Type ?integer

Returns…

Description The URL to the thumbnail
Type URLPATH

Return to the function index for this class Expand: View the source code to this function

boolean check_memory_limit_for(PATH file_path, boolean exit_on_error)

Check we can load the given file, given our memory limit.

Parameters…

Name file_path
Description The file path we are trying to load
Type PATH

Name exit_on_error
Description Whether to exit ocPortal if an error occurs
Default value boolean-true
Type boolean

Returns…

Description Success status
Type boolean

Return to the function index for this class Expand: View the source code to this function

boolean convert_image(URLPATH from, PATH to, integer width, integer height, integer box_width, boolean exit_on_error, ?string ext2, boolean using_path, boolean only_make_smaller, ?array thumb_options)

Resize an image to the specified size, but retain the aspect ratio.

Parameters…

Name from
Description The URL to the image to resize
Type URLPATH

Name to
Description The file path (including filename) to where the resized image will be saved
Type PATH

Name width
Description The maximum width we want our new image to be (-1 means "don't factor this in")
Type integer

Name height
Description The maximum height we want our new image to be (-1 means "don't factor this in")
Type integer

Name box_width
Description This is only considered if both $width and $height are -1. If set, it will fit the image to a box of this dimension (suited for resizing both landscape and portraits fairly)
Default value -1
Type integer

Name exit_on_error
Description Whether to exit ocPortal if an error occurs
Default value boolean-true
Type boolean

Name ext2
Description The file extension to save with (NULL: same as our input file)
Default value
Type ?string

Name using_path
Description Whether $from was in fact a path, not a URL
Default value boolean-false
Type boolean

Name only_make_smaller
Description Whether to apply a 'never make the image bigger' rule for thumbnail creation (would affect very small images)
Default value boolean-false
Type boolean

Name thumb_options
Description This optional parameter allows us to specify cropping or padding for the image. See comments in the function. (NULL: no details passed)
Default value
Type ?array

Returns…

Description Success
Type boolean

Return to the function index for this class Expand: View the source code to this function

float get_gd_version()

Get the version number of GD on the system. It should only be called if GD is known to be on the system, and in use

Parameters…

Returns…

Description The version of GD installed
Type float

Return to the function index for this class Expand: View the source code to this function

boolean is_image(string name)

Find whether the image specified is actually an image, based on file extension

Parameters…

Name name
Description A URL or file path to the image
Type string

Returns…

Description Whether the string pointed to a file appeared to be an image
Type boolean

Return to the function index for this class Expand: View the source code to this function

boolean is_video(string name, boolean must_be_true_video)

Find whether the video specified is actually a 'video', based on file extension

Parameters…

Name name
Description A URL or file path to the video
Type string

Name must_be_true_video
Description Whether it really must be an actual video/audio, not some other kind of rich media which we may render in a video spot
Default value boolean-false
Type boolean

Returns…

Description Whether the string pointed to a file appeared to be a video
Type boolean

Return to the function index for this class Expand: View the source code to this function

boolean is_saveable_image(string name)

Use the image extension to determine if the specified image is of a format (extension) saveable by ocPortal or not.

Parameters…

Name name
Description A URL or file path to the image
Type string

Returns…

Description Whether the string pointed to a file that appeared to be a saveable image
Type boolean

Return to the function index for this class Expand: View the source code to this function

sources/galleries.php

Global_functions_galleries.php

Function summary

void init__galleries ()
tempcode render_image_box (array row, ID_TEXT zone)
tempcode render_video_box (array row, ID_TEXT zone)
integer get_default_gallery_max ()
boolean gallery_has_content (ID_TEXT name)
?MEMBER get_member_id_from_gallery_name (ID_TEXT gallery_name, ?array row)
tempcode show_video_details (array myrow)
tempcode show_gallery_box (array child, ID_TEXT root, boolean show_member_stats_if_appropriate, ID_TEXT zone, boolean quit_if_empty, boolean preview)
array get_recursive_gallery_details (ID_TEXT name, boolean test_videos, boolean test_images)
boolean only_download_galleries (ID_TEXT cat)
boolean only_conventional_galleries (ID_TEXT cat)
boolean only_member_galleries_of_id (ID_TEXT cat, ?MEMBER member_id, integer child_count)
tempcode nice_get_gallery_tree (?ID_TEXT it, ?string filter, boolean must_accept_images, boolean must_accept_videos, boolean purity, boolean use_compound_list, ?MEMBER member_id, boolean addable_filter)
array get_gallery_tree (?ID_TEXT category_id, string tree, ?array gallery_info, boolean do_stats, ?string filter, boolean must_accept_images, boolean must_accept_videos, boolean purity, boolean use_compound_list, ?integer levels, ?MEMBER member_id, boolean addable_filter)
~integer can_submit_to_gallery (ID_TEXT name)
tempcode gallery_breadcrumbs (ID_TEXT category_id, ID_TEXT root, boolean no_link_for_me_sir, ID_TEXT zone)
tempcode nice_get_gallery_content_tree (ID_TEXT table, ?ID_TEXT it, ?AUTO_LINK submitter, boolean use_compound_list, boolean editable_filter)
array get_gallery_content_tree (ID_TEXT table, ?AUTO_LINK submitter, ?ID_TEXT gallery, ?string tree, ?ID_TEXT title, ?integer levels, boolean use_compound_list, boolean editable_filter)
tempcode show_gallery_media (URLPATH url, URLPATH thumb_url, integer width, integer height, integer length, ?ID_TEXT orig_filename)
string get_allowed_video_file_types ()

void init__galleries()

Standard code module initialisation function.

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function

tempcode render_image_box(array row, ID_TEXT zone)

Render an image box.

Parameters…

Name row
Description The video row
Type array

Name zone
Description The zone the galleries module is in
Default value _SEARCH
Type ID_TEXT

Returns…

Description The rendered box
Type tempcode

Return to the function index for this class Expand: View the source code to this function

tempcode render_video_box(array row, ID_TEXT zone)

Render a video box.

Parameters…

Name row
Description The video row
Type array

Name zone
Description The zone the galleries module is in
Default value _SEARCH
Type ID_TEXT

Returns…

Description The rendered box
Type tempcode

Return to the function index for this class Expand: View the source code to this function

integer get_default_gallery_max()

Find the default number of images per page in the galleries.

Parameters…

Returns…

Description Images per page
Type integer

Return to the function index for this class Expand: View the source code to this function

boolean gallery_has_content(ID_TEXT name)

Find whether a certain gallery has any content (images, videos, or subgalleries).

Parameters…

Name name
Description The name of the gallery
Type ID_TEXT

Returns…

Description The answer
Type boolean

Return to the function index for this class Expand: View the source code to this function

?MEMBER get_member_id_from_gallery_name(ID_TEXT gallery_name, ?array row)

Find the owner of a gallery.

Parameters…

Name gallery_name
Description The name of the gallery
Type ID_TEXT

Name row
Description Gallery row (NULL: look it up)
Default value
Type ?array

Returns…

Description The owner of the gallery (NULL: not a member owned gallery)
Type ?MEMBER

Return to the function index for this class Expand: View the source code to this function

tempcode show_video_details(array myrow)

Get preview detailing for a video.

Parameters…

Name myrow
Description The database row of the video
Type array

Returns…

Description The preview
Type tempcode

Return to the function index for this class Expand: View the source code to this function

tempcode show_gallery_box(array child, ID_TEXT root, boolean show_member_stats_if_appropriate, ID_TEXT zone, boolean quit_if_empty, boolean preview)

Get preview detailing for a gallery.

Parameters…

Name child
Description The database row of the gallery
Type array

Name root
Description The virtual root of the gallery
Default value root
Type ID_TEXT

Name show_member_stats_if_appropriate
Description Whether to show member stats if it is a member owned gallery
Default value boolean-false
Type boolean

Name zone
Description The zone that the gallery module we are linking to is in
Default value _SEARCH
Type ID_TEXT

Name quit_if_empty
Description Whether to not show anything if the gallery is empty
Default value boolean-true
Type boolean

Name preview
Description Whether only to show 'preview' details
Default value boolean-false
Type boolean

Returns…

Description The preview
Type tempcode

Return to the function index for this class Expand: View the source code to this function

array get_recursive_gallery_details(ID_TEXT name, boolean test_videos, boolean test_images)

Get details of the contents of a gallery.

Parameters…

Name name
Description The name of the gallery
Type ID_TEXT

Name test_videos
Description Whether to test for videos when making counts (ignore this parameter - used internally)
Default value boolean-true
Type boolean

Name test_images
Description Whether to test for images when making counts (ignore this parameter - used internally)
Default value boolean-true
Type boolean

Returns…

Description A triplet: (num children, num images, num videos)
Type array

Return to the function index for this class Expand: View the source code to this function

boolean only_download_galleries(ID_TEXT cat)

See whether a gallery is a download gallery (designed as a filter).

Parameters…

Name cat
Description The gallery name
Type ID_TEXT

Returns…

Description Whether the gallery is a download gallery
Type boolean

Return to the function index for this class Expand: View the source code to this function

boolean only_conventional_galleries(ID_TEXT cat)

See whether a gallery is NOT a download gallery (designed as a filter).

Parameters…

Name cat
Description The gallery name
Type ID_TEXT

Returns…

Description Whether the gallery is NOT a download gallery
Type boolean

Return to the function index for this class Expand: View the source code to this function

boolean only_member_galleries_of_id(ID_TEXT cat, ?MEMBER member_id, integer child_count)

See whether the GET parameter 'id' is of a gallery that is a member gallery of the given member gallery container, or just a normal gallery.

Parameters…

Name cat
Description The gallery name
Type ID_TEXT

Name member_id
Description Member we are filtering for (NULL: not needed)
Type ?MEMBER

Name child_count
Description The number of children for this gallery
Type integer

Returns…

Description The answer
Type boolean

Return to the function index for this class Expand: View the source code to this function

tempcode nice_get_gallery_tree(?ID_TEXT it, ?string filter, boolean must_accept_images, boolean must_accept_videos, boolean purity, boolean use_compound_list, ?MEMBER member_id, boolean addable_filter)

Gets a gallery selection tree list, extending deeper from the given category_id, showing all sub(sub...)galleries.

Parameters…

Name it
Description The gallery to select by default (NULL: no specific default)
Default value
Type ?ID_TEXT

Name filter
Description A function name to filter galleries with (NULL: no filter)
Default value
Type ?string

Name must_accept_images
Description Whether displayed galleries must support images
Default value boolean-false
Type boolean

Name must_accept_videos
Description Whether displayed galleries must support videos
Default value boolean-false
Type boolean

Name purity
Description Whether to NOT show member galleries that do not exist yet
Default value boolean-false
Type boolean

Name use_compound_list
Description Whether to get a list of child galleries (not just direct ones, recursively), instead of just IDs
Default value boolean-false
Type boolean

Name member_id
Description Member we are filtering for (NULL: not needed)
Default value
Type ?MEMBER

Name addable_filter
Description Whether to only show for what may be added to by the current member
Default value boolean-false
Type boolean

Returns…

Description The tree list
Type tempcode

Return to the function index for this class Expand: View the source code to this function

array get_gallery_tree(?ID_TEXT category_id, string tree, ?array gallery_info, boolean do_stats, ?string filter, boolean must_accept_images, boolean must_accept_videos, boolean purity, boolean use_compound_list, ?integer levels, ?MEMBER member_id, boolean addable_filter)

Gets a gallery selection tree list, extending deeper from the given category_id, showing all sub(sub...)galleries.

Parameters…

Name category_id
Description The gallery we are getting the tree starting from (NULL: root)
Default value root
Type ?ID_TEXT

Name tree
Description The parent tree at this point of the recursion
Default value
Type string

Name gallery_info
Description The database row for the $category_id gallery (NULL: get it from the DB)
Default value
Type ?array

Name do_stats
Description Whether to include video/image statistics in the returned tree
Default value boolean-true
Type boolean

Name filter
Description A function name to filter galleries with (NULL: no filter)
Default value
Type ?string

Name must_accept_images
Description Whether displayed galleries must support images
Default value boolean-false
Type boolean

Name must_accept_videos
Description Whether displayed galleries must support videos
Default value boolean-false
Type boolean

Name purity
Description Whether to NOT show member galleries that do not exist yet
Default value boolean-false
Type boolean

Name use_compound_list
Description Whether to get a list of child galleries (not just direct ones, recursively), instead of just IDs
Default value boolean-false
Type boolean

Name levels
Description The number of recursive levels to search (NULL: all)
Default value
Type ?integer

Name member_id
Description Member we are filtering for (NULL: not needed)
Default value
Type ?MEMBER

Name addable_filter
Description Whether to only show for what may be added to by the current member
Default value boolean-false
Type boolean

Returns…

Description The tree structure, or if $use_compound_list, the tree structure built with pairs containing the compound list in addition to the child branches
Type array

Return to the function index for this class Expand: View the source code to this function

~integer can_submit_to_gallery(ID_TEXT name)

See whether the current member can submit to the named member gallery. Note - this function assumes that members have general submit permission, and does not check for gallery read access.

Parameters…

Name name
Description The gallery name
Type ID_TEXT

Returns…

Description The owner of the gallery (false: we aren't allowed to submit to it) (-2: not a member gallery)
Type ~integer

Return to the function index for this class Expand: View the source code to this function

tempcode gallery_breadcrumbs(ID_TEXT category_id, ID_TEXT root, boolean no_link_for_me_sir, ID_TEXT zone)

Get a UI element of a route from a known gallery back to the declared root of the tree.

Parameters…

Name category_id
Description The gallery name
Type ID_TEXT

Name root
Description The virtual root
Default value root
Type ID_TEXT

Name no_link_for_me_sir
Description Whether not to put a link at this point in the navigation tree (usually, because the viewer is already at it)
Default value boolean-true
Type boolean

Name zone
Description The zone that the linked to gallery module is in
Default value
Type ID_TEXT

Returns…

Description The navigation element
Type tempcode

Return to the function index for this class Expand: View the source code to this function

tempcode nice_get_gallery_content_tree(ID_TEXT table, ?ID_TEXT it, ?AUTO_LINK submitter, boolean use_compound_list, boolean editable_filter)

Get a nice, formatted XHTML list of gallery entries, in gallery tree structure

Parameters…

Name table
Description The table we are working with
Type ID_TEXT
Values restricted to images videos

Name it
Description The currently selected entry (NULL: none selected)
Default value
Type ?ID_TEXT

Name submitter
Description Only show images/videos submitted by this member (NULL: no filter)
Default value
Type ?AUTO_LINK

Name use_compound_list
Description Whether to get a list of child galleries (not just direct ones, recursively), instead of just IDs
Default value boolean-false
Type boolean

Name editable_filter
Description Whether to only show for what may be edited by the current member
Default value boolean-false
Type boolean

Returns…

Description The list of entries
Type tempcode

Return to the function index for this class Expand: View the source code to this function

array get_gallery_content_tree(ID_TEXT table, ?AUTO_LINK submitter, ?ID_TEXT gallery, ?string tree, ?ID_TEXT title, ?integer levels, boolean use_compound_list, boolean editable_filter)

Get a list of maps containing all the gallery entries, and path information, under the specified gallery - and those beneath it, recursively.

Parameters…

Name table
Description The table we are working with
Type ID_TEXT
Values restricted to images videos

Name submitter
Description Only show images/videos submitted by this member (NULL: no filter)
Default value
Type ?AUTO_LINK

Name gallery
Description The gallery being at the root of our recursion (NULL: true root)
Default value
Type ?ID_TEXT

Name tree
Description The tree up to this point in the recursion (NULL: blank, as we are starting the recursion)
Default value
Type ?string

Name title
Description The name of the $gallery we are currently going through (NULL: look it up). This is here for efficiency reasons, as finding children IDs to recurse to also reveals the childs title
Default value
Type ?ID_TEXT

Name levels
Description The number of recursive levels to search (NULL: all)
Default value
Type ?integer

Name use_compound_list
Description Whether to get a list of child galleries (not just direct ones, recursively), instead of just IDs
Default value boolean-false
Type boolean

Name editable_filter
Description Whether to only show for what may be edited by the current member
Default value boolean-false
Type boolean

Returns…

Description A list of maps for all galleries. Each map entry containins the fields 'id' (gallery ID) and 'tree' (tree path to the category, including the categories own title), and more. Or if $use_compound_list, the tree structure built with pairs containing the compound list in addition to the child branches
Type array

Return to the function index for this class Expand: View the source code to this function

tempcode show_gallery_media(URLPATH url, URLPATH thumb_url, integer width, integer height, integer length, ?ID_TEXT orig_filename)

Show a gallery media item (not an image, something more complex)

Parameters…

Name url
Description URL to media
Type URLPATH

Name thumb_url
Description URL to thumbnail
Type URLPATH

Name width
Description Width
Type integer

Name height
Description Height
Type integer

Name length
Description Length
Type integer

Name orig_filename
Description Original filename of media file (NULL: find from URL)
Default value
Type ?ID_TEXT

Returns…

Description Displayed media
Type tempcode

Return to the function index for this class Expand: View the source code to this function

string get_allowed_video_file_types()

Get a comma-separated list of allowed file types for video upload.

Parameters…

Returns…

Description Allowed file types
Type string

Return to the function index for this class Expand: View the source code to this function

sources/galleries2.php

Global_functions_galleries2.php

Function summary

~array get_video_details (PATH file_path, string filename, boolean delay_errors)
integer read_intel_endian_int (string buffer)
integer read_network_endian_int (string buffer)
array _get_wmv_details (resource file)
?array _get_wmv_details_do_chunk_list (resource file, ?integer chunk_length)
array _get_avi_details (resource file)
?array _get_ram_details (resource file)
?array _get_mov_details (resource file)
array _get_mov_details_do_atom_list (resource file, ?integer atom_size)
AUTO_LINK add_image (SHORT_TEXT title, ID_TEXT cat, LONG_TEXT comments, URLPATH url, URLPATH thumb_url, BINARY validated, BINARY allow_rating, BINARY allow_comments, BINARY allow_trackbacks, LONG_TEXT notes, ?MEMBER submitter, ?TIME add_date, ?TIME edit_date, integer views, ?AUTO_LINK id)
void edit_image (AUTO_LINK id, SHORT_TEXT title, ID_TEXT cat, LONG_TEXT comments, URLPATH url, URLPATH thumb_url, BINARY validated, BINARY allow_rating, BINARY allow_comments, BINARY allow_trackbacks, LONG_TEXT notes, SHORT_TEXT meta_keywords, LONG_TEXT meta_description)
void delete_image (AUTO_LINK id, boolean delete_full)
URLPATH create_video_thumb (URLPATH src_url, ?PATH expected_output_path)
AUTO_LINK add_video (SHORT_TEXT title, ID_TEXT cat, LONG_TEXT comments, URLPATH url, URLPATH thumb_url, BINARY validated, BINARY allow_rating, BINARY allow_comments, BINARY allow_trackbacks, LONG_TEXT notes, integer video_length, integer video_width, integer video_height, ?MEMBER submitter, ?TIME add_date, ?TIME edit_date, integer views, ?AUTO_LINK id)
void edit_video (AUTO_LINK id, SHORT_TEXT title, ID_TEXT cat, LONG_TEXT comments, URLPATH url, URLPATH thumb_url, BINARY validated, BINARY allow_rating, BINARY allow_comments, BINARY allow_trackbacks, LONG_TEXT notes, integer video_length, integer video_width, integer video_height, SHORT_TEXT meta_keywords, LONG_TEXT meta_description)
void delete_video (AUTO_LINK id, boolean delete_full)
void watermark_gallery_image (ID_TEXT gallery, PATH file_path, string filename)
void _watermark_corner (resource source, URLPATH watermark_url, BINARY x, BINARY y)
void constrain_gallery_image_to_max_size (PATH file_path, string filename, integer box_width)
void add_gallery (ID_TEXT name, SHORT_TEXT fullname, LONG_TEXT description, SHORT_TEXT teaser, LONG_TEXT notes, ID_TEXT parent_id, BINARY accept_images, BINARY accept_videos, BINARY is_member_synched, BINARY flow_mode_interface, URLPATH rep_image, URLPATH watermark_top_left, URLPATH watermark_top_right, URLPATH watermark_bottom_left, URLPATH watermark_bottom_right, BINARY allow_rating, BINARY allow_comments, boolean skip_exists_check, ?TIME add_date, ?MEMBER g_owner)
void edit_gallery (ID_TEXT old_name, ID_TEXT name, SHORT_TEXT fullname, LONG_TEXT description, SHORT_TEXT teaser, LONG_TEXT notes, ?ID_TEXT parent_id, BINARY accept_images, BINARY accept_videos, BINARY is_member_synched, BINARY flow_mode_interface, URLPATH rep_image, URLPATH watermark_top_left, URLPATH watermark_top_right, URLPATH watermark_bottom_left, URLPATH watermark_bottom_right, ?SHORT_TEXT meta_keywords, ?LONG_TEXT meta_description, BINARY allow_rating, BINARY allow_comments, ?MEMBER g_owner)
void delete_gallery (ID_TEXT name)
void make_member_gallery_if_needed (ID_TEXT cat)

~array get_video_details(PATH file_path, string filename, boolean delay_errors)

Get width,height,length of a video file. Note: unfortunately mpeg is not possible without huge amounts of code.

Parameters…

Name file_path
Description The path to the video file
Type PATH

Name filename
Description The original filename of the video file (so we can find the file type from the file extension)
Type string

Name delay_errors
Description Whether to skip over errored files instead of dying. We don't currently make use of this as our readers aren't sophisticard enough to properly spot erroneous situations.
Default value boolean-false
Type boolean

Returns…

Description The triplet of width/height/length (possibly containing NULL's for when we can't detect properties) (false: error)
Type ~array

Return to the function index for this class Expand: View the source code to this function

integer read_intel_endian_int(string buffer)

Read an integer from the given binary chunk. The integer is in intel endian form.

Parameters…

Name buffer
Description The binary chunk
Type string

Returns…

Description The integer
Type integer

Return to the function index for this class Expand: View the source code to this function

integer read_network_endian_int(string buffer)

Read an integer from the given binary chunk. The integer is in network endian form.

Parameters…

Name buffer
Description The binary chunk
Type string

Returns…

Description The integer
Type integer

Return to the function index for this class Expand: View the source code to this function

array _get_wmv_details(resource file)

Get width,height,length of a .wmv video file.

Parameters…

Name file
Description The file handle
Type resource

Returns…

Description The triplet (possibly containing NULL's for when we can't detect properties)
Type array

Return to the function index for this class Expand: View the source code to this function

?array _get_wmv_details_do_chunk_list(resource file, ?integer chunk_length)

Get chunk-bytes-read,width,height,length of a chunk list of a .wmv video file.

Parameters…

Name file
Description The file handle
Type resource

Name chunk_length
Description The length of the current chunk list (NULL: covers full file)
Default value
Type ?integer

Returns…

Description The quartet (possibly containing NULL's for when we can't detect properties) (NULL: error)
Type ?array

Return to the function index for this class Expand: View the source code to this function

array _get_avi_details(resource file)

Get width,height,length of a .avi video file.

Parameters…

Name file
Description The file handle
Type resource

Returns…

Description The triplet (possibly containing NULL's for when we can't detect properties)
Type array

Return to the function index for this class Expand: View the source code to this function

?array _get_ram_details(resource file)

Get width,height,length of a .rm/.ram video file.

Parameters…

Name file
Description The file handle
Type resource

Returns…

Description The triplet (possibly containing NULL's for when we can't detect properties) (NULL: error)
Type ?array

Return to the function index for this class Expand: View the source code to this function

?array _get_mov_details(resource file)

Get width,height,length of a .mov/.qt video file.

Parameters…

Name file
Description The file handle
Type resource

Returns…

Description The triplet (possibly containing NULL's for when we can't detect properties) (NULL: error)
Type ?array

Return to the function index for this class Expand: View the source code to this function

array _get_mov_details_do_atom_list(resource file, ?integer atom_size)

Get chunk-bytes-read,width,height,length of a atom list of a .mov/.qt video file.

Parameters…

Name file
Description The file handle
Type resource

Name atom_size
Description The length of the current atom list (NULL: covers full file)
Default value
Type ?integer

Returns…

Description The quartet (possibly containing NULL's for when we can't detect properties)
Type array

Return to the function index for this class Expand: View the source code to this function

AUTO_LINK add_image(SHORT_TEXT title, ID_TEXT cat, LONG_TEXT comments, URLPATH url, URLPATH thumb_url, BINARY validated, BINARY allow_rating, BINARY allow_comments, BINARY allow_trackbacks, LONG_TEXT notes, ?MEMBER submitter, ?TIME add_date, ?TIME edit_date, integer views, ?AUTO_LINK id)

Add an image to a specified gallery.

Parameters…

Name title
Description Image title
Type SHORT_TEXT

Name cat
Description The gallery name
Type ID_TEXT

Name comments
Description The image comments
Type LONG_TEXT

Name url
Description The URL to the actual image
Type URLPATH

Name thumb_url
Description The URL to the thumbnail of the actual image
Type URLPATH

Name validated
Description Whether the image has been validated for display on the site
Type BINARY

Name allow_rating
Description Whether the image may be rated
Type BINARY

Name allow_comments
Description Whether the image may be commented upon
Type BINARY

Name allow_trackbacks
Description Whether the image may be trackbacked
Type BINARY

Name notes
Description Hidden notes associated with the image
Type LONG_TEXT

Name submitter
Description The submitter (NULL: current member)
Default value
Type ?MEMBER

Name add_date
Description The time of adding (NULL: now)
Default value
Type ?TIME

Name edit_date
Description The time of editing (NULL: never)
Default value
Type ?TIME

Name views
Description The number of views
Default value 0
Type integer

Name id
Description Force an ID (NULL: don't force an ID)
Default value
Type ?AUTO_LINK

Returns…

Description The ID of the new entry
Type AUTO_LINK

Return to the function index for this class Expand: View the source code to this function

void edit_image(AUTO_LINK id, SHORT_TEXT title, ID_TEXT cat, LONG_TEXT comments, URLPATH url, URLPATH thumb_url, BINARY validated, BINARY allow_rating, BINARY allow_comments, BINARY allow_trackbacks, LONG_TEXT notes, SHORT_TEXT meta_keywords, LONG_TEXT meta_description)

Edit an image in a specified gallery.

Parameters…

Name id
Description The ID of the image to edit
Type AUTO_LINK

Name title
Description Image title
Type SHORT_TEXT

Name cat
Description The gallery name
Type ID_TEXT

Name comments
Description The image comments
Type LONG_TEXT

Name url
Description The URL to the actual image
Type URLPATH

Name thumb_url
Description The URL to the thumbnail of the actual image
Type URLPATH

Name validated
Description Whether the image has been validated for display on the site
Type BINARY

Name allow_rating
Description Whether the image may be rated
Type BINARY

Name allow_comments
Description Whether the image may be commented upon
Type BINARY

Name allow_trackbacks
Description Whether the image may be trackbacked
Type BINARY

Name notes
Description Hidden notes associated with the image
Type LONG_TEXT

Name meta_keywords
Description Meta keywords
Type SHORT_TEXT

Name meta_description
Description Meta description
Type LONG_TEXT

(No return value)


Return to the function index for this class Expand: View the source code to this function

void delete_image(AUTO_LINK id, boolean delete_full)

Delete a specified image from the database, and delete the file if possible.

Parameters…

Name id
Description The ID of the image
Type AUTO_LINK

Name delete_full
Description Whether to delete the actual file also
Type boolean

(No return value)


Return to the function index for this class Expand: View the source code to this function

URLPATH create_video_thumb(URLPATH src_url, ?PATH expected_output_path)

Create a video thumbnail.

Parameters…

Name src_url
Description Video to get thumbail from (must be local)
Type URLPATH

Name expected_output_path
Description Where to save to (NULL: decide for ourselves)
Default value
Type ?PATH

Returns…

Description Thumbnail, only valid if expected_output_path was passed as NULL (blank: could not generate)
Type URLPATH

Return to the function index for this class Expand: View the source code to this function

AUTO_LINK add_video(SHORT_TEXT title, ID_TEXT cat, LONG_TEXT comments, URLPATH url, URLPATH thumb_url, BINARY validated, BINARY allow_rating, BINARY allow_comments, BINARY allow_trackbacks, LONG_TEXT notes, integer video_length, integer video_width, integer video_height, ?MEMBER submitter, ?TIME add_date, ?TIME edit_date, integer views, ?AUTO_LINK id)

Add a video to a specified gallery.

Parameters…

Name title
Description Video title
Type SHORT_TEXT

Name cat
Description The gallery name
Type ID_TEXT

Name comments
Description The video comments
Type LONG_TEXT

Name url
Description The URL to the actual video
Type URLPATH

Name thumb_url
Description The URL to the thumbnail of the actual video
Type URLPATH

Name validated
Description Whether the video has been validated for display on the site
Type BINARY

Name allow_rating
Description Whether the video may be rated
Type BINARY

Name allow_comments
Description Whether the video may be commented upon
Type BINARY

Name allow_trackbacks
Description Whether the video may be trackbacked
Type BINARY

Name notes
Description Hidden notes associated with the video
Type LONG_TEXT

Name video_length
Description The length of the video
Type integer

Name video_width
Description The width of the video
Type integer

Name video_height
Description The height of the video
Type integer

Name submitter
Description The submitter (NULL: current member)
Default value
Type ?MEMBER

Name add_date
Description The time of adding (NULL: now)
Default value
Type ?TIME

Name edit_date
Description The time of editing (NULL: never)
Default value
Type ?TIME

Name views
Description The number of views
Default value 0
Type integer

Name id
Description Force an ID (NULL: don't force an ID)
Default value
Type ?AUTO_LINK

Returns…

Description The ID of the new entry
Type AUTO_LINK

Return to the function index for this class Expand: View the source code to this function

void edit_video(AUTO_LINK id, SHORT_TEXT title, ID_TEXT cat, LONG_TEXT comments, URLPATH url, URLPATH thumb_url, BINARY validated, BINARY allow_rating, BINARY allow_comments, BINARY allow_trackbacks, LONG_TEXT notes, integer video_length, integer video_width, integer video_height, SHORT_TEXT meta_keywords, LONG_TEXT meta_description)

Edit a video in a specified gallery.

Parameters…

Name id
Description The ID of the entry to edit
Type AUTO_LINK

Name title
Description Video title
Type SHORT_TEXT

Name cat
Description The gallery name
Type ID_TEXT

Name comments
Description The video comments
Type LONG_TEXT

Name url
Description The URL to the actual video
Type URLPATH

Name thumb_url
Description The URL to the thumbnail of the actual video
Type URLPATH

Name validated
Description Whether the video has been validated for display on the site
Type BINARY

Name allow_rating
Description Whether the video may be rated
Type BINARY

Name allow_comments
Description Whether the video may be commented upon
Type BINARY

Name allow_trackbacks
Description Whether the video may be trackbacked
Type BINARY

Name notes
Description Hidden notes associated with the video
Type LONG_TEXT

Name video_length
Description The length of the video
Type integer

Name video_width
Description The width of the video
Type integer

Name video_height
Description The height of the video
Type integer

Name meta_keywords
Description Meta keywords
Type SHORT_TEXT

Name meta_description
Description Meta description
Type LONG_TEXT

(No return value)


Return to the function index for this class Expand: View the source code to this function

void delete_video(AUTO_LINK id, boolean delete_full)

Delete a video in a specified gallery.

Parameters…

Name id
Description The ID of the entry to delete
Type AUTO_LINK

Name delete_full
Description Whether to delete the actual video file from disk as well as the entry
Type boolean

(No return value)


Return to the function index for this class Expand: View the source code to this function

void watermark_gallery_image(ID_TEXT gallery, PATH file_path, string filename)

Watermarks an image with the appropriate gallery watermarks.

Parameters…

Name gallery
Description The name of the gallery for the image
Type ID_TEXT

Name file_path
Description The path to the image file
Type PATH

Name filename
Description The original file name of the image
Type string

(No return value)


Return to the function index for this class Expand: View the source code to this function

void _watermark_corner(resource source, URLPATH watermark_url, BINARY x, BINARY y)

Watermark the corner of an image.

Parameters…

Name source
Description The image resource being watermarked
Type resource

Name watermark_url
Description The (local) URL to the watermark file
Type URLPATH

Name x
Description Whether a right hand side corner is being watermarked
Type BINARY

Name y
Description Whether a bottom edge corner is being watermarked
Type BINARY

(No return value)


Return to the function index for this class Expand: View the source code to this function

void constrain_gallery_image_to_max_size(PATH file_path, string filename, integer box_width)

Make sure the detailed image file is not bigger than the defined box width.

Parameters…

Name file_path
Description The path to the image file
Type PATH

Name filename
Description The original filename of the image
Type string

Name box_width
Description The box width
Type integer

(No return value)


Return to the function index for this class Expand: View the source code to this function

void add_gallery(ID_TEXT name, SHORT_TEXT fullname, LONG_TEXT description, SHORT_TEXT teaser, LONG_TEXT notes, ID_TEXT parent_id, BINARY accept_images, BINARY accept_videos, BINARY is_member_synched, BINARY flow_mode_interface, URLPATH rep_image, URLPATH watermark_top_left, URLPATH watermark_top_right, URLPATH watermark_bottom_left, URLPATH watermark_bottom_right, BINARY allow_rating, BINARY allow_comments, boolean skip_exists_check, ?TIME add_date, ?MEMBER g_owner)

Add a gallery with the specified parameters.

Parameters…

Name name
Description The gallery codename
Type ID_TEXT

Name fullname
Description The full human-readeable name of the gallery
Type SHORT_TEXT

Name description
Description The description of the gallery
Type LONG_TEXT

Name teaser
Description Teaser text for the gallery
Type SHORT_TEXT

Name notes
Description Hidden notes associated with the gallery
Type LONG_TEXT

Name parent_id
Description The parent gallery (blank: no parent)
Type ID_TEXT

Name accept_images
Description Whether images may be put in this gallery
Default value 1
Type BINARY

Name accept_videos
Description Whether videos may be put in this gallery
Default value 1
Type BINARY

Name is_member_synched
Description Whether the gallery serves as a container for automatically created member galleries
Default value 0
Type BINARY

Name flow_mode_interface
Description Whether the gallery uses the flow mode interface
Default value 0
Type BINARY

Name rep_image
Description The representative image of the gallery (blank: none)
Default value
Type URLPATH

Name watermark_top_left
Description Watermark (blank: none)
Default value
Type URLPATH

Name watermark_top_right
Description Watermark (blank: none)
Default value
Type URLPATH

Name watermark_bottom_left
Description Watermark (blank: none)
Default value
Type URLPATH

Name watermark_bottom_right
Description Watermark (blank: none)
Default value
Type URLPATH

Name allow_rating
Description Whether rating are allowed
Default value 1
Type BINARY

Name allow_comments
Description Whether comments are allowed
Default value 1
Type BINARY

Name skip_exists_check
Description Whether to skip the check for whether the gallery exists (useful for importers)
Default value boolean-false
Type boolean

Name add_date
Description The add time (NULL: now)
Default value
Type ?TIME

Name g_owner
Description The gallery owner (NULL: nobody)
Default value
Type ?MEMBER

(No return value)


Return to the function index for this class Expand: View the source code to this function

void edit_gallery(ID_TEXT old_name, ID_TEXT name, SHORT_TEXT fullname, LONG_TEXT description, SHORT_TEXT teaser, LONG_TEXT notes, ?ID_TEXT parent_id, BINARY accept_images, BINARY accept_videos, BINARY is_member_synched, BINARY flow_mode_interface, URLPATH rep_image, URLPATH watermark_top_left, URLPATH watermark_top_right, URLPATH watermark_bottom_left, URLPATH watermark_bottom_right, ?SHORT_TEXT meta_keywords, ?LONG_TEXT meta_description, BINARY allow_rating, BINARY allow_comments, ?MEMBER g_owner)

Edit a gallery.

Parameters…

Name old_name
Description The old gallery codename (in case we are renaming)
Type ID_TEXT

Name name
Description The gallery codename (maybe the same as the old one)
Type ID_TEXT

Name fullname
Description The full human-readeable name of the gallery
Type SHORT_TEXT

Name description
Description The description of the gallery
Type LONG_TEXT

Name teaser
Description Teaser text for the gallery
Type SHORT_TEXT

Name notes
Description Hidden notes associated with the gallery
Type LONG_TEXT

Name parent_id
Description The parent gallery (NULL: no parent)
Default value
Type ?ID_TEXT

Name accept_images
Description Whether images may be put in this gallery
Default value 1
Type BINARY

Name accept_videos
Description Whether videos may be put in this gallery
Default value 1
Type BINARY

Name is_member_synched
Description Whether the gallery serves as a container for automatically created member galleries
Default value 0
Type BINARY

Name flow_mode_interface
Description Whether the gallery uses the flow mode interface
Default value 0
Type BINARY

Name rep_image
Description The representative image of the gallery (blank: none)
Default value
Type URLPATH

Name watermark_top_left
Description Watermark (blank: none)
Default value
Type URLPATH

Name watermark_top_right
Description Watermark (blank: none)
Default value
Type URLPATH

Name watermark_bottom_left
Description Watermark (blank: none)
Default value
Type URLPATH

Name watermark_bottom_right
Description Watermark (blank: none)
Default value
Type URLPATH

Name meta_keywords
Description Meta keywords for this resource (NULL: do not edit)
Default value
Type ?SHORT_TEXT

Name meta_description
Description Meta description for this resource (NULL: do not edit)
Default value
Type ?LONG_TEXT

Name allow_rating
Description Whether rating are allowed
Default value 1
Type BINARY

Name allow_comments
Description Whether comments are allowed
Default value 1
Type BINARY

Name g_owner
Description The gallery owner (NULL: nobody)
Default value
Type ?MEMBER

(No return value)


Return to the function index for this class Expand: View the source code to this function

void delete_gallery(ID_TEXT name)

Delete a specified gallery.

Parameters…

Name name
Description The gallery codename
Type ID_TEXT

(No return value)


Return to the function index for this class Expand: View the source code to this function

void make_member_gallery_if_needed(ID_TEXT cat)

The UI shows member galleries that do not exist. If it is a member gallery, and it does not exist, it'll need making, before something can be added. This gallery performs the check and makes the gallery if needed.

Parameters…

Name cat
Description The gallery name
Type ID_TEXT

(No return value)


Return to the function index for this class Expand: View the source code to this function


ocPortal prefers PNG files over other image types. This is troubled by a lack of good support in Microsoft Internet Explorer.
PNG files have the added advantage that they can be 'alpha-blended' so that crisp, blended, images may be presented (as opposed to gif files, which have to be hard-blended into the background colour of your website).
Internet Explorer does not this alpha blending directly, which is why PNG image files 'pop' into being blended on page load… a special automated/transparent hack is applied to conduct the blending.
The negative side effects of this hack is the popping effect, the inability to have locally resized PNG images, and the inability to do the thumbnail blur effect used on other image file types. We believe that the blending advantages majorly outweigh these small problems but we hope that Microsoft improve support soon (All other major browsers do not have any issue).