[ Index ]
 

Code source de Serendipity 1.2

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/include/ -> functions_images.inc.php (sommaire)

(pas de description)

Poids: 3368 lignes (124 kb)
Inclus ou requis: 1 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 50 fonctions

  serendipity_isActiveFile()
  serendipity_fetchImagesFromDatabase()
  serendipity_fetchImageFromDatabase()
  serendipity_updateImageInDatabase()
  serendipity_deleteImage()
  serendipity_fetchImages()
  serendipity_insertHotlinkedImageInDatabase()
  serendipity_insertImageInDatabase()
  serendipity_makeThumbnail()
  serendipity_scaleImg()
  serendipity_rotateImg()
  serendipity_generateThumbs()
  serendipity_guessMime()
  serendipity_syncThumbs()
  serendipity_functions_gd()
  serendipity_rotate_image_gd()
  serendipity_resize_image_gd()
  serendipity_calculate_aspect_size()
  serendipity_displayImageList()
  serendipity_isImage()
  serendipity_killPath()
  serendipity_traversePath()
  serendipity_sortPath()
  serendipity_deletePath()
  serendipity_uploadSecure()
  serendipity_getimagesize()
  serendipity_getImageFields()
  serendipity_escapeshellarg()
  serendipity_renameDir()
  serendipity_dirSlash()
  serendipity_directoryACL()
  serendipity_getThumbNailPath()
  serendipity_getImageData()
  serendipity_showPropertyForm()
  serendipity_parseMediaProperties()
  serendipity_mediaTypeCast()
  serendipity_insertMediaProperty()
  serendipity_parsePropertyForm()
  serendipity_fetchMediaProperties()
  serendipity_checkPropertyAccess()
  serendipity_prepareMedia()
  serendipity_showMedia()
  serendipity_metaFieldConvert()
  serendipity_getMediaRaw()
  serendipity_getMetaData()
  serendipity_imageAppend()
  serendipity_checkMediaSize()
  serendipity_moveMediaDirectory()
  serendipity_getMediaPaths()
  serendipity_checkDirUpload()

Fonctions
Fonctions qui ne font pas partie d'une Classe:

serendipity_isActiveFile($file)   X-Ref
Check if an uploaded file is "evil"

param: string  Input filename
return: boolean

serendipity_fetchImagesFromDatabase($start=0, $limit=0, &$total, $order = false, $ordermode = false, $directory = '', $filename = '', $keywords = '', $filter = array()   X-Ref
Gets a list of media items from our media database

LONG

param: int     The offset to start fetching media files
param: int     How many items to fetch
param: int     The number (referenced varaible) of fetched items
param: string  The "ORDER BY" sql part when fetching items
param: string  Order by DESC or ASC
param: string  Only fetch files from a specific directory
param: string  Only fetch specific filenames
param: string  Only fetch media with specific keyword
param: array   An array of restricting filter sets
param: boolean Apply strict directory checks, or include subdirectories?
return: array   Resultset of images

serendipity_fetchImageFromDatabase($id, $mode = 'read')   X-Ref
Fetch a specific media item from the mediadatabase

param: int     The ID of an media item
return: array   The media info data

serendipity_updateImageInDatabase($updates, $id)   X-Ref
Update a media item

param: array       An array of columns to update
param: int         The ID of an media item to update
return: boolean

serendipity_deleteImage($id)   X-Ref
Delete a media item

param: int     The ID of a media item to delete
return:

serendipity_fetchImages($group = false, $start = 0, $end = 20, $images = '', $odir = '')   X-Ref
Open a directory and fetch all existing media items

param: boolean     deprecated
param: int         deprecated
param: int         deprecated
param: array       Array list of found items
param: string      sub-directory to investigate [recursive use]
return: array       List of media items

serendipity_insertHotlinkedImageInDatabase($filename, $url, $authorid = 0, $time = NULL, $tempfile = NULL)   X-Ref
Inserts a hotlinked media file

hotlinks are files that are only linked in your database, and not really stored on your server

param: string      The filename to hotlink
param: string      The URL to hotlink with
param: int         The owner of the hotlinked media item
param: int         The timestamp of insertion (unix second)
param: string      A temporary filename for fetching the file to investigate it
return: int         The ID of the inserted media item

serendipity_insertImageInDatabase($filename, $directory, $authorid = 0, $time = NULL, $realname = NULL)   X-Ref
Insert a media item in the database

param: string      The filename of the media item
param: string      The path to the media item
param: int         The owner author of the item
param: int         The timestamp of when the media item was inserted
return: int         The new media ID

serendipity_makeThumbnail($file, $directory = '', $size = false, $thumbname = false, $is_temporary = false, $force_resize = false)   X-Ref
Create a thumbnail for an image

LONG

param: string      The input image filename
param: string      The directory to the image file
param: string      The target size of the thumbnail (2-dimensional array width,height)
param: string      Name of the thumbnail
param: bool        Store thumbnail in temporary place?
param: bool        Force enlarging of small images?
return: array       The result size of the thumbnail

serendipity_scaleImg($id, $width, $height)   X-Ref
Scale an image

LONG

param: int     The ID of an image
param: int     The target width
param: int     The target height
return: true

serendipity_rotateImg($id, $degrees)   X-Ref
Rotate an image

LONG

param: int     The ID of an image
param: int     Number of degrees to rotate
return: boolean

serendipity_generateThumbs()   X-Ref
Creates thumbnails for all images in the upload dir

return: int Number of created thumbnails

serendipity_guessMime($extension)   X-Ref
Guess the MIME type of a file

param: string  Filename extension
return: string  Mimetype

serendipity_syncThumbs()   X-Ref
Check all existing thumbnails if they are the right size, insert missing thumbnails

LONG

return: int     Number of updated thumbnails

serendipity_functions_gd($infilename)   X-Ref
Wrapper for GDLib functions

param: string      Filename to operate on
return: string       Functionname to execute

serendipity_rotate_image_gd($infilename, $outfilename, $degrees)   X-Ref
Rotate an image (GDlib)

param: string      Source Filename to rotate
param: string      Target file
param: int         Degress to rotate
return: array       New width/height of the image

serendipity_resize_image_gd($infilename, $outfilename, $newwidth, $newheight=null)   X-Ref
Resize an image (GDLib)

param: string      Source Filename to resize
param: string      Target file
param: int         New width
return: int         New height (can be autodetected)
return: array       New image size

serendipity_calculate_aspect_size($width, $height, $orig_newwidth, $orig_newheight = null)   X-Ref
Calculate aspect ratio of an image

param: int     Image width
param: int     Image height
param: int     Target width
return: int     Target height

serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = false, $url = NULL, $show_upload = false, $limit_path = NULL, $smarty_display = true)   X-Ref
Display the list of images in our database

param: int     The current page number
param: string  The HTML linebreak to use after a row of images
param: boolean Should the toolbar for editing media files be shown?
param: string  The URL to use for pagination
param: boolean Show the "upload media item" feature?
param: boolean Restrict viewing images to a specific directory
param: boolean  If TRUE, will echo Smarty output.
return: string   Smarty block name

serendipity_isImage(&$file, $strict = false)   X-Ref
Check if a media item is an image

param: array       File information
param: boolean     Use a strict check that does not list PDFs as an image?
return: boolean     True if the file is an image

serendipity_killPath($basedir, $directory = '', $forceDelete = false)   X-Ref
Recursively delete a directory tree

param: string      The originating directory
param: string      The subdirectory
param: boolean     Force deleting an directory even if there are files left in it?
return: true

serendipity_traversePath($basedir, $dir='', $onlyDirs = true, $pattern = NULL, $depth = 1, $max_depth = NULL, $apply_ACL = false, $aExcludeDirs = NULL)   X-Ref
Recursively walk a directory tree

param: string      The core directory
param: string      The subdirectory
param: boolean     Only return directories instead of files as well?
param: string      A regexp patter to include files
param: int         Level of nesting (recursive use)
param: int         The maximum level of nesting (recursive use)
param: mixed       Toggle whether to apply serendipity_directoryACL (false / 'read' / 'write')
param: array       An array of directories to skip [passed by plugins, for example]
return: array       Array of files/directories

serendipity_sortPath($a, $b)   X-Ref
Custom usort() function that properly sorts a path

param: array      First array
param: array      Second array
return:

serendipity_deletePath($dir)   X-Ref
Delete a directory with all its files

param: string      The directory to delete
return:

serendipity_uploadSecure($var, $strip_paths = true, $append_slash = false)   X-Ref
Check if a entered HTTP upload path is valid

param: string      The input filename
param: boolean     Shall all paths be stripped?
param: boolean     Shall a trailing slash be appended?
return: string      The condom-wrapped path/file info

serendipity_getimagesize($file, $ft_mime = '', $suf = '')   X-Ref
Get the imagesize for a file

param: string      The filename of the image
param: string      The mimetype of an image (can be autodetected)
param: string      The file extension of an image
return: array       The width/height of the file

serendipity_getImageFields()   X-Ref
Get the available fields of the media database

return: array    Array with available, sortable fields

serendipity_escapeshellarg($string)   X-Ref
Escape a shell argument for imagemagick use

param: string  Input argument
return: string  Output argument

serendipity_renameDir($old, $new)   X-Ref
Rename a media directory

param: string  Old directory name
param: string  New directory name

serendipity_dirSlash($type, $dir)   X-Ref
Makes sure a directory begins with or ends with a "/"

param: string  Type of where to append/prepend slash ('end', 'start', 'both')
param: string  Directory name
return: string  Output argument

serendipity_directoryACL(&$paths, $type = 'read')   X-Ref
Cycle a serendipity_traversePath resultset and apply read/write ACLs.

param: array   serendipity_traversePath result array
param: string  ACL type ('read', 'write')

serendipity_getThumbNailPath($sRelativePath, $sName, $sExtension, $sThumbName)   X-Ref
Build the name of a thumbnail image file.

author: MTG
param: string   Relative Path
param: string   File name
param: string   File extension
param: string   Thumbnail suffix
return: array    Thumbnail path

serendipity_getImageData($sRelativePath)   X-Ref
Given a relative path to an image, construct an array containing all
relevant information about that image in the file structure.

author: MTG
param: string   Relative Path
return: array    Data about image

serendipity_showPropertyForm(&$new_media, $keywordsPerBlock = 3, $is_edit = true)   X-Ref
Shows the HTML form to add/edit properties of uploaded media items

param: array    Associative array holding an array('image_id', 'target', 'created_thumbnail') that points to the uploaded media
param: int      How many keyword checkboxes to display next to each other?
param: boolean  Can existing data be modified?
return: boolean

serendipity_parseMediaProperties(&$dprops, &$keywords, &$media, &$props, $keywordsPerBlock, $is_edit)   X-Ref
Parse/Convert properties

param: array    Holds the property key array
param: array    Holds the keyword key array
param: int      Holds the media metadata
param: int      Holds the media properties
param: int      How many keyword checkboxes to display next to each other?
param: boolean  Can existing data be modified?
return: boolean

serendipity_mediaTypeCast($key, $val, $invert = false)   X-Ref
Tries to auto-convert specific fields into DB-storable values

param: string   The keyname
param: string   The value
param: string   Invert?
return: array    array('image_id') holding the last created thumbnail for immediate processing

serendipity_insertMediaProperty($property_group, $property_subgroup = '', $image_id, &$media, $use_cast = true)   X-Ref
Inserts media properties

param: string  Property_group
return: array    array('image_id') holding the last created thumbnail for immediate processing

serendipity_parsePropertyForm()   X-Ref
Inserts the submitted properties of uploaded media items

return: array    array('image_id') holding the last created thumbnail for immediate processing

serendipity_fetchMediaProperties($id)   X-Ref
Fetches existing Media Properties for images

param: int      The media item id
return: array    Array of image metadata

serendipity_checkPropertyAccess(&$new_media, &$additional, $mode = 'read')   X-Ref
Checks if properties to a specific image are allowed to be fetched

param: array    Array of image metadata
param: array    Array of additional image metadata
param: string   ACL toggle type ('read', 'write')
return: array    Stripped Array of image metadata

serendipity_prepareMedia(&$file, $url = '')   X-Ref
Prepare a media item for showing

param: array    Array of image metadata
param: string   URL for maintenance tasks
return: bool

serendipity_showMedia(&$file, &$paths, $url = '', $manage = false, $lineBreak = 3, $enclose = true, $smarty_vars = array()   X-Ref
Prints a media item

param: array    Array of image metadata
param: string   URL for maintenance tasks
param: boolean  Whether to show maintenance task items
param: int      how many media items to display per row
param: boolean  Enclose within a table cell?
param: array    Additional Smarty variables
param: boolean  If TRUE, will echo Smarty output.
return: string   Smarty block name

serendipity_metaFieldConvert(&$item, $type)   X-Ref
Convert a IPTC/EXIF/XMP item

param: string   The content
param: string   The type of the content
return: string   The converted content

serendipity_getMediaRaw($filename)   X-Ref
Get the RAW media header data (XMP)

param: string   Filename
return: array    The raw media header data

serendipity_getMetaData($file, &$info)   X-Ref
Get the IPTC/EXIF/XMP media metadata

param: string   Filename
return: array    The raw media header data

serendipity_imageAppend(&$tfile, &$target, $dir, $echo = true)   X-Ref
Parses an existing filename and increases the filecount.

param: string   The (duplicate) filename
param: string   The full path to the (duplicate) filename
param: string   The directory of the (duplicate) filename
param: boolean  Show new filename?
return: string   The new filename

serendipity_checkMediaSize($file)   X-Ref
Checks if an uploaded media item hits any configured limits.

param: string   The filename
return: boolean  TRUE when file is okay, FALSE when it is beyond limits

serendipity_moveMediaDirectory($oldDir, $newDir, $type = 'dir', $item_id = null, $file = null)   X-Ref
Moves a media directory

param: string   The old directory
param: string   The new directory
param: string   The type of what to remove (dir|file|filedir)
param: string   An item id of a file
return: boolean

serendipity_getMediaPaths()   X-Ref
Gets all available media directories

return: array

serendipity_checkDirUpload($dir)   X-Ref
Checks whether a user has access to write into a directory

param: string Directory to check
return: boolean



Généré le : Sat Nov 24 09:00:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics