Overview

Packages

  • admin
  • classes
    • media
  • CodeIgniter
    • Libraries
  • core
  • functions
  • JSMin
  • None
  • OpenID
  • PHP
  • PHPMailer
  • plugins
    • admin
    • development
    • feed
    • mail
    • media
    • misc
    • seo
    • spam
    • uploader
    • users
    • zenpage
    • zenphoto
      • news
  • Services
    • JSON

Classes

  • _zp_captcha
  • _zp_HTML_cache
  • admin_approval
  • Album
  • AlbumBase
  • AlbumZip
  • AMFReader
  • AMFStream
  • AnyFile
  • AnyFile_Options
  • Auth_OpenID
  • Auth_OpenID_AlreadySigned
  • Auth_OpenID_AssociateRequest
  • Auth_OpenID_Association
  • Auth_OpenID_AuthRequest
  • Auth_OpenID_AX
  • Auth_OpenID_AX_AttrInfo
  • Auth_OpenID_AX_Error
  • Auth_OpenID_AX_FetchRequest
  • Auth_OpenID_AX_FetchResponse
  • Auth_OpenID_AX_KeyValueMessage
  • Auth_OpenID_AX_Message
  • Auth_OpenID_AX_StoreRequest
  • Auth_OpenID_AX_StoreResponse
  • Auth_OpenID_BcMathWrapper
  • Auth_OpenID_CancelResponse
  • Auth_OpenID_CheckAuthRequest
  • Auth_OpenID_CheckIDRequest
  • Auth_OpenID_Consumer
  • Auth_OpenID_ConsumerResponse
  • Auth_OpenID_CryptUtil
  • Auth_OpenID_DatabaseConnection
  • Auth_OpenID_Decoder
  • Auth_OpenID_DiffieHellman
  • Auth_OpenID_DiffieHellmanSHA1ConsumerSession
  • Auth_OpenID_DiffieHellmanSHA1ServerSession
  • Auth_OpenID_DiffieHellmanSHA256ConsumerSession
  • Auth_OpenID_DiffieHellmanSHA256ServerSession
  • Auth_OpenID_DumbStore
  • Auth_OpenID_Encoder
  • Auth_OpenID_EncodingError
  • Auth_OpenID_Extension
  • Auth_OpenID_FailureResponse
  • Auth_OpenID_FileStore
  • Auth_OpenID_GenericConsumer
  • Auth_OpenID_GmpMathWrapper
  • Auth_OpenID_KVForm
  • Auth_OpenID_MalformedReturnURL
  • Auth_OpenID_MalformedTrustRoot
  • Auth_OpenID_Mapping
  • Auth_OpenID_MathLibrary
  • Auth_OpenID_MDB2Store
  • Auth_OpenID_MemcachedStore
  • Auth_OpenID_Message
  • Auth_OpenID_MySQLStore
  • Auth_OpenID_NamespaceMap
  • Auth_OpenID_NoReturnToError
  • Auth_OpenID_OpenIDStore
  • Auth_OpenID_PAPE_Request
  • Auth_OpenID_PAPE_Response
  • Auth_OpenID_Parse
  • Auth_OpenID_PlainTextConsumerSession
  • Auth_OpenID_PlainTextServerSession
  • Auth_OpenID_PostgreSQLStore
  • Auth_OpenID_Request
  • Auth_OpenID_Server
  • Auth_OpenID_ServerError
  • Auth_OpenID_ServerErrorContainer
  • Auth_OpenID_ServerRequest
  • Auth_OpenID_ServerResponse
  • Auth_OpenID_ServiceEndpoint
  • Auth_OpenID_ServiceEndpointLoader
  • Auth_OpenID_SessionNegotiator
  • Auth_OpenID_SetupNeededResponse
  • Auth_OpenID_Signatory
  • Auth_OpenID_SigningEncoder
  • Auth_OpenID_SQLiteStore
  • Auth_OpenID_SQLStore
  • Auth_OpenID_SRegBase
  • Auth_OpenID_SRegRequest
  • Auth_OpenID_SRegResponse
  • Auth_OpenID_SuccessResponse
  • Auth_OpenID_TrustRoot
  • Auth_OpenID_TypeURIMismatch
  • Auth_OpenID_UntrustedReturnURL
  • Auth_OpenID_WebResponse
  • Auth_Yadis_Discovery
  • Auth_Yadis_DiscoveryResult
  • Auth_Yadis_dom
  • Auth_Yadis_domxml
  • Auth_Yadis_HTTPFetcher
  • Auth_Yadis_HTTPResponse
  • Auth_Yadis_Manager
  • Auth_Yadis_ManagerLoader
  • Auth_Yadis_ParanoidHTTPFetcher
  • Auth_Yadis_ParseHTML
  • Auth_Yadis_PHPSession
  • Auth_Yadis_PlainHTTPFetcher
  • Auth_Yadis_ProxyResolver
  • Auth_Yadis_Service
  • Auth_Yadis_SessionLoader
  • Auth_Yadis_XMLParser
  • Auth_Yadis_XRDS
  • Auth_Yadis_Yadis
  • auto_backup
  • AVCSequenceParameterSetReader
  • bxslider
  • cacheManager
  • cacheManagerFeed
  • CI_jsmin
  • CI_load
  • cloneZenphoto
  • codeIgniter_kludge
  • colorbox
  • Comment
  • comment_form
  • contactformOptions
  • crop_image
  • cycle
  • defaultCodeblocks
  • deprecated_functions
  • DownloadList
  • dynamic_locale
  • dynamicAlbum
  • elFinder_options
  • email_new_user
  • exampleMacros
  • external_auth
  • ExternalFeed
  • externalFeed_options
  • favorites
  • favoritesOptions
  • federated_logon
  • feed
  • fieldExtender
  • flag_thumbnail
  • Gallery
  • galleryArticles
  • getID3
  • getid3_aac
  • getid3_apetag
  • getid3_flv
  • getid3_handler
  • getid3_id3v1
  • getid3_id3v2
  • getid3_lib
  • getid3_lyrics3
  • getid3_mp3
  • getid3_mpeg
  • getid3_quicktime
  • getid3_swf
  • GoogleMap
  • Googlemaps
  • googleVerifyOptions
  • hitcounter
  • HTML
  • htmlmetatags
  • http_auth
  • Image
  • image_effects
  • internal_deprecations
  • ipBlocker
  • jcarousel
  • jPlayer
  • jplayer_options
  • jquery_rating
  • JSMin
  • lib_GD_Options
  • lib_Imagick_Options
  • lib_NoGraphics
  • MediaObject
  • menu_manager
  • MergedRSS
  • MergedRSSOptions
  • mobile
  • Mobile_Detect
  • mobileTheme
  • multipleLayoutOptions
  • null_seo
  • OAuthConsumer
  • OAuthDataStore
  • OAuthRequest
  • OAuthServer
  • OAuthSignatureMethod
  • OAuthSignatureMethod_HMAC_SHA1
  • OAuthSignatureMethod_PLAINTEXT
  • OAuthSignatureMethod_RSA_SHA1
  • OAuthToken
  • OAuthUtil
  • pagedThumbsNav
  • pagedthumbsOptions
  • PclZip
  • PersistentObject
  • PHPMailer
  • PlainText
  • POP3
  • print_album_menu
  • pseudoPlayer
  • publishContent
  • quota_manager
  • reCaptcha
  • ReCaptchaResponse
  • register_user
  • rewriteRules
  • rewriteTokens
  • RSS
  • RSS_internal_deprecations
  • rss_options
  • search_statistics
  • SearchEngine
  • security_logger
  • seo_locale
  • Services_JSON
  • Services_JSON_Error
  • setupexternalFeed
  • setupRSS
  • show_not_loggedin
  • sitemap
  • slideshow
  • SMTP
  • static_html_cache
  • tagsuggest
  • TextObject
  • TextObject_internal_deprecations
  • TextObject_Options
  • ThemeObject
  • themeSwitcher
  • tinymce4Options
  • tinyURL
  • Transientimage
  • tweet
  • TwitterOAuth
  • UploadHandler
  • user_expiry
  • user_groups
  • user_logout_options
  • userAddressFields
  • utf8
  • Video
  • Video_internal_deprecations
  • VideoObject_Options
  • viewer_size_image_options
  • WEBdocs
  • WEBdocs_Options
  • xmpMetadata
  • Zenpage
  • Zenpage_internal_deprecations
  • ZenpageCategory
  • zenpagecms
  • ZenpageItems
  • ZenpageNews
  • ZenpagePage
  • ZenpageRoot
  • Zenphoto_Administrator
  • Zenphoto_Authority
  • zenphoto_org_news
  • zenphoto_seo
  • zenphotoDonate
  • ZipStream
  • zp_PHPMailer
  • zpCaptcha
  • zpFunctions
  • zpLegacySpam
  • zpMutex
  • zpSimpleSpam
  • zpTrivialSpam

Exceptions

  • BadFunctionCallException
  • BadMethodCallException
  • Exception
  • getid3_exception
  • JSMin_UnterminatedCommentException
  • JSMin_UnterminatedRegExpException
  • JSMin_UnterminatedStringException
  • LogicException
  • OAuthExcept
  • phpmailerException

Functions

  • __autoload
  • _escape_xref
  • _recaptcha_aes_encrypt
  • _recaptcha_aes_pad
  • _recaptcha_http_post
  • _recaptcha_mailhide_email_parts
  • _recaptcha_mailhide_urlbase64
  • _recaptcha_qsencode
  • accessAllAlbums
  • add_context
  • addalbumsToDatabase
  • addCategoriesToDatabase
  • addGeoCoord
  • addItem
  • addPagesToDatabase
  • addPluginScript
  • addPluginType
  • addSubalbumMenus
  • admin_album_list
  • admin_securityChecks
  • admin_showupdate
  • adminPageNav
  • adminToolbox
  • albumNumber
  • applyMacros
  • Auth_OpenID_arrangeByType
  • Auth_OpenID_AX_checkAlias
  • Auth_OpenID_AX_toTypeURIs
  • Auth_OpenID_bestMatchingService
  • Auth_OpenID_checkFieldName
  • Auth_OpenID_checkSessionType
  • Auth_OpenID_checkTimestamp
  • Auth_OpenID_detectMathLibrary
  • Auth_OpenID_discover
  • Auth_OpenID_discoverURI
  • Auth_OpenID_discoverWithoutYadis
  • Auth_OpenID_discoverWithYadis
  • Auth_OpenID_discoverXRI
  • Auth_OpenID_extractReturnURL
  • Auth_OpenID_findOPLocalIdentifier
  • Auth_OpenID_getAllAssociationTypes
  • Auth_OpenID_getAllowedReturnURLs
  • Auth_OpenID_getAuthorityPattern
  • Auth_OpenID_getAvailableSessionTypes
  • Auth_OpenID_getDefaultAssociationOrder
  • Auth_OpenID_getDefaultGen
  • Auth_OpenID_getDefaultMod
  • Auth_OpenID_getDefaultNegotiator
  • Auth_OpenID_getEncodedPattern
  • Auth_OpenID_getEncryptedNegotiator
  • Auth_OpenID_getEscapeRE
  • Auth_OpenID_getMathLib
  • Auth_OpenID_getOnlyEncryptedOrder
  • Auth_OpenID_getOpenIDConsumerTypeURIs
  • Auth_OpenID_getOpenIDTypeName
  • Auth_OpenID_getOpenIDTypeURIs
  • Auth_OpenID_getOPOrUserServices
  • Auth_OpenID_getSecretSize
  • Auth_OpenID_getSessionTypes
  • Auth_OpenID_getSupportedAssociationTypes
  • Auth_OpenID_getUnreserved
  • Auth_OpenID_getURIPattern
  • Auth_OpenID_getURLIllegalCharRE
  • Auth_OpenID_HMACSHA1
  • Auth_OpenID_HMACSHA256
  • Auth_OpenID_include_init
  • Auth_OpenID_isError
  • Auth_OpenID_isOpenID1
  • Auth_OpenID_legacy_discover
  • Auth_OpenID_makeOpenIDEndpoints
  • Auth_OpenID_math_extensions
  • Auth_OpenID_mkNonce
  • Auth_OpenID_noMathSupport
  • Auth_OpenID_pct_encoded_replace
  • Auth_OpenID_pct_encoded_replace_unreserved
  • Auth_OpenID_registerNamespaceAlias
  • Auth_OpenID_remove_dot_segments
  • Auth_OpenID_removeNamespaceAlias
  • Auth_OpenID_returnToMatches
  • Auth_OpenID_setNoMathSupport
  • Auth_OpenID_SHA1
  • Auth_OpenID_SHA256
  • Auth_OpenID_splitNonce
  • Auth_OpenID_supportsSReg
  • Auth_OpenID_urinorm
  • Auth_OpenID_verifyReturnTo
  • Auth_Yadis_array_scramble
  • Auth_Yadis_escapeForIRI
  • Auth_Yadis_getCanonicalID
  • Auth_Yadis_getDefaultProxy
  • Auth_Yadis_getEscapeRE
  • Auth_Yadis_getIPrivateChars
  • Auth_Yadis_getNSMap
  • Auth_Yadis_getServiceEndpoints
  • Auth_Yadis_getSupportedExtensions
  • Auth_Yadis_getUCSChars
  • Auth_Yadis_getXMLParser
  • Auth_Yadis_getXRDExpiration
  • Auth_Yadis_getXrefRE
  • Auth_Yadis_getXRIAuthorities
  • Auth_Yadis_identifierScheme
  • Auth_Yadis_iriToURI
  • Auth_Yadis_pct_escape_unicode
  • Auth_Yadis_providerIsAuthoritative
  • Auth_Yadis_rootAuthority
  • Auth_Yadis_setDefaultParser
  • Auth_Yadis_startswith
  • Auth_Yadis_toIRINormal
  • Auth_Yadis_toURINormal
  • Auth_Yadis_XRI
  • Auth_Yadis_XRIAppendArgs
  • authorSelector
  • build_query
  • build_url
  • bulkActionRedirect
  • bulkTags
  • byteConvert
  • cacheImage
  • checkAccess
  • checkAlbumimagesort
  • checkAlbumParentid
  • checkAlbumPassword
  • checkChosenItemStatus
  • checkChosenMenuset
  • checked
  • checkFolder
  • checkForEmptyTitle
  • checkForGuest
  • checkForPage
  • checkForPassword
  • checkForUpdate
  • checkHitcounterDisplay
  • checkIfChecked
  • checkIfLockedNews
  • checkIfLockedPage
  • checkIfNew
  • checkInstall
  • checkLayoutUseForImages
  • checkNewsAccess
  • checkNewsCategoryPassword
  • checkObjectsThumb
  • checkPagePassword
  • checkPageValidity
  • checkParentLayouts
  • checkPublishDates
  • checkRequiredField
  • checkSelectedAlbum
  • checkSignature
  • cleanAlbum
  • cleanHTML
  • clearSitemapCache
  • clonedFrom
  • codeblocktabsJS
  • comment_form_addComment
  • comment_form_handle_comment
  • comment_form_PaginationJS
  • comment_form_postcomment
  • comment_form_print10Most
  • comment_form_visualEditor
  • commentFormUseCaptcha
  • commentReply
  • commentsAllowed
  • consolidatedEditMessages
  • copyLayoutSelection
  • copyThemeDirectory
  • countArticles
  • countCombiNews
  • createMenuIfNotExists
  • createRelatedItemsResultArray
  • cron_starter
  • currentRelativeURL
  • customOptions
  • dateDiff
  • datepickerJS
  • dateTimeConvert
  • db_affected_rows
  • db_close
  • db_collation
  • db_connect
  • db_count
  • db_create
  • db_create_table
  • db_error
  • db_fetch_assoc
  • db_fetch_row
  • db_free_result
  • db_getSQLmode
  • db_insert_id
  • db_LIKE_escape
  • db_list_fields
  • db_name
  • db_num_rows
  • db_permissions
  • db_quote
  • db_setSQLmode
  • db_show
  • db_software
  • db_table_update
  • db_truncate_table
  • debug404
  • debugLog
  • debugLogBacktrace
  • debugLogVar
  • defaultCodeblocks_codebox
  • deleteArticle
  • deleteCategory
  • deleteItem
  • deleteLayoutSelection
  • deletePage
  • deleteThemeDirectory
  • detect_fetcher
  • detect_math
  • detect_query_corruption
  • detect_random
  • detect_stores
  • detect_xml
  • dircopy
  • displayError
  • doIncludes
  • elFinder_admin_tabs
  • elFinder_tinymce
  • enableExtension
  • escape
  • executeRSS
  • exitZP
  • exposeZenPhotoInformations
  • extensionEnabled
  • fetchComments
  • filesystemToInternal
  • filter_extractReturnURL
  • filter_MatchesAnyOpenIDConsumerType
  • filter_MatchesAnyOpenIDType
  • filterImageQuery
  • fix_path_redirect
  • formatList
  • fullText
  • galleryAlbumsPerPage
  • genAlbumList
  • generateCaptcha
  • generateLanguageList
  • generateListFromArray
  • generateListFromFiles
  • generateRadiobuttonsFromArray
  • generateSitemapCacheFile
  • generateSitemapIndexCacheFile
  • generateUnorderedListFromArray
  • get_AnyFile_suffixes
  • get_context
  • get_filterScript
  • get_instance
  • get_language_string
  • getAdminThumb
  • getAlbumArray
  • getAlbumBreadcrumb
  • getAlbumBreadcrumbAdmin
  • getAlbumCustomData
  • getAlbumData
  • getAlbumDate
  • getAlbumDesc
  • getAlbumFolder
  • getAlbumGeodata
  • getAlbumId
  • getAlbumInherited
  • getAlbumLinkURL
  • getAlbumLocation
  • getAlbumPage
  • getAlbumPlace
  • getAlbumStatistic
  • getAlbumThumb
  • getAlbumTitle
  • getAlbumURL
  • getAllAccessibleAlbums
  • getAllAlbums
  • getAllArticleDates
  • getAllCategories
  • getAllDates
  • getAllowedTags
  • getAllSubAlbumIDs
  • getAllSubalbums
  • getAllTagsCount
  • getAllTagsFromAlbum
  • getAllTagsFromAlbum_multi_unique
  • getAllTagsFromZenpage
  • getAllTagsUnique
  • getAllTranslations
  • getAnnotatedAlbumTitle
  • getAnnotatedImageTitle
  • getArticles
  • getAuthor
  • getBare
  • getBareAlbumDesc
  • getBareAlbumTitle
  • getBareGalleryDesc
  • getBareGalleryTitle
  • getBareImageDesc
  • getBareImageTitle
  • getBareNewsAlbumTitle
  • getBareNewsTitle
  • getBarePageTitle
  • getCategory
  • getCategoryID
  • getCategoryLink
  • getCategoryParentID
  • getCategorySortOrder
  • getCategoryTitle
  • getCheckboxState
  • getCodeblock
  • getCombiNews
  • getCommentAddress
  • getCommentAuthorEmail
  • getCommentAuthorLink
  • getCommentAuthorName
  • getCommentAuthorSite
  • getCommentBody
  • getCommentCount
  • getCommentDate
  • getCommentDateTime
  • getCommentErrors
  • getCommentsAllowed
  • getCommentStored
  • getCommentTime
  • getConsumer
  • getContentShorten
  • getCurrentMenuItem
  • getCurrentNewsArchive
  • getCurrentNewsCategory
  • getCurrentNewsCategoryID
  • getCurrentNewsCategoryParentID
  • getCurrentNewsPage
  • getCurrentPage
  • getCurrentTheme
  • getCustomAlbumThumb
  • getCustomAlbumThumbMaxSpace
  • getCustomImageURL
  • getCustomPageURL
  • getCustomSizedImageMaxSpace
  • getCustomSizedImageThumbMaxSpace
  • getDefaultHeight
  • getDefaultSizedImage
  • getDefaultWidth
  • getDownloadLink
  • getdownloadList
  • getDownloadURL
  • getE
  • getEnabledPlugins
  • getExpiryDatePost
  • getFavoritesURL
  • getField
  • getFirstImageURL
  • getFullHeight
  • getFullImageURL
  • getFullNewsImage
  • getFullWidth
  • getGalleryDesc
  • getGalleryIndexURL
  • getGalleryTitle
  • getGeoCoord
  • getHeadTitle
  • getHitcounter
  • getImageArgs
  • getImageCacheFilename
  • getImageCachePostfix
  • getImageCity
  • getImageCountry
  • getImageCustomData
  • getImageData
  • getImageDate
  • getImageDesc
  • getImageEXIFData
  • getImageGeodata
  • getImageID
  • getImageLinkURL
  • getImageLocation
  • getImageMetaData
  • getImageParameters
  • getImageProcessorURI
  • getImageProcessorURIFromCacheName
  • getImageRotation
  • getImageSortOrder
  • getImageState
  • getImageStatistic
  • getImageThumb
  • getImageTitle
  • getImageURI
  • getImageURL
  • getItem
  • getItemByID
  • getItemTitleAndURL
  • getjPlayerSkinCSS
  • getjPlayerSkins
  • getLanguageArray
  • getLanguageFlag
  • getLastImageURL
  • getLatestComments
  • getLatestNews
  • getLatestZenpageComments
  • getLayout
  • getLayoutSelector
  • getLink
  • getLinkHTML
  • getLogTabs
  • getMacros
  • getMainSiteName
  • getMainSiteURL
  • getManagedAlbumList
  • getMaxSpaceContainer
  • getMenuFromLink
  • getMenuItemChilds
  • getMenuItems
  • getMenumanagerPredicessor
  • getMenumanagerSuccessor
  • getMenuSetSelector
  • getMenuVisibility
  • getMimeString
  • getNestedAlbumList
  • getNewsAdminOption
  • getNewsAdminOptionPath
  • getNewsAlbumName
  • getNewsAlbumTitle
  • getNewsAlbumURL
  • getNewsArchivePath
  • getNewsArchiveURL
  • getNewsAuthor
  • getNewsCategories
  • getNewsCategoryCustomData
  • getNewsCategoryDesc
  • getNewsCategoryPath
  • getNewsCategoryURL
  • getNewsContent
  • getNewsContentShorten
  • getNewsCustomData
  • getNewsDate
  • getNewsExtraContent
  • getNewsID
  • getNewsImageTags
  • getNewsIndexURL
  • getNewsLink
  • getNewsPagesStatistic
  • getNewsPathNav
  • getNewsReadMore
  • getNewsTitle
  • getNewsTitleLink
  • getNewsTitlePath
  • getNewsType
  • getNewsURL
  • getNewsVideoContent
  • getNextAlbum
  • getNextAlbumURL
  • getNextImageThumb
  • getNextImageURL
  • getNextNewsPageURL
  • getNextNewsURL
  • getNextPageURL
  • getNextPrevNews
  • getNotViewableAlbums
  • getNotViewableImages
  • getNumAlbums
  • getNumAllSubalbums
  • getNumImages
  • getNumNews
  • getNumPages
  • getNumSubalbums
  • getOpenIDURL
  • getOption
  • getOptionFromDB
  • getOptionList
  • getPageAuthor
  • getPageContent
  • getPageCustomData
  • getPageDate
  • getPageExtraContent
  • getPageID
  • getPageLastChangeDate
  • getPageLinkPath
  • getPageLinkURL
  • getPageNavList
  • getPageNumURL
  • getPageParentID
  • getPageRedirect
  • getPages
  • getPageSelector
  • getPageSortorder
  • getPageTitle
  • getPageTitleLink
  • getPageURL
  • getParentAlbums
  • getParentAlbumsAdmin
  • getParentBreadcrumb
  • getParentItems
  • getParentMenuItems
  • getParentNewsCategories
  • getParentPages
  • getPasswordProtectImage
  • getPHPFiles
  • getPlugin
  • getPluginFiles
  • getPluginTabs
  • getPrevAlbum
  • getPrevAlbumURL
  • getPrevImageThumb
  • getPrevImageURL
  • getPrevNewsPageURL
  • getPrevNewsURL
  • getPrevPageURL
  • getProtectedImageURL
  • getRandomImages
  • getRandomImagesAlbum
  • getRating
  • getRelatedItems
  • getRequestURI
  • getReturnTo
  • getRSSHeaderLink
  • getRSSLink
  • getScheme
  • getSearchDate
  • getSearchURL
  • getSearchWords
  • getSelectedLayout
  • getSerializedArray
  • getSetClause
  • getSiteHomeURL
  • getSitemapAlbumList
  • getSitemapAlbums
  • getSitemapGoogleImageVideoExtras
  • getSitemapGoogleLoopIndex
  • getSitemapImages
  • getSitemapIndexLinks
  • getSitemapZenpageNewsArticles
  • getSitemapZenpageNewsCategories
  • getSitemapZenpageNewsIndex
  • getSitemapZenpagePages
  • getSizeCustomImage
  • getSizeDefaultImage
  • getSizeDefaultThumb
  • getSizedImageURL
  • getSizeFullImage
  • getStore
  • getSubCategories
  • getSubtabs
  • getSuffix
  • getTagCountByAccess
  • getTagOrder
  • getTags
  • gettext_pl
  • gettext_th
  • getTheme
  • getThemeFiles
  • getThemeOption
  • getTimezones
  • getTinyMCE4ConfigFiles
  • getTitle
  • getTotalArticles
  • getTotalImagesIn
  • getTotalNewsPages
  • getTotalPages
  • getTrustRoot
  • getUnprotectedImageURL
  • getUrAlbum
  • getURL
  • getUserIP
  • getUserLocale
  • getVersion
  • getViewerImageSize
  • getWatermarkParam
  • getWatermarkPath
  • getWatermarks
  • getWhereClause
  • getXSRFToken
  • getZenpageHitcounter
  • getZenpageRSSHeaderLink
  • getZenpageRSSLink
  • getZenpageStatistic
  • googleVerifyHead
  • handleSearchParms
  • hasDynamicAlbumSuffix
  • hasNextImage
  • hasNextPage
  • hasPrevImage
  • hasPrevPage
  • hitcounter
  • html_decode
  • html_encode
  • html_encodeTagged
  • httpsRedirect
  • httpUploadHandler
  • httpUploadHandler_admin_tabs
  • i18nSetLocale
  • imageBlurGD
  • imageDebug
  • imageError
  • imageNumber
  • imgSrcURI
  • in_context
  • inNewsCategory
  • inProtectedNewsCategory
  • installSignature
  • instrument
  • inSubNewsCategoryOf
  • internalToFilesystem
  • inventMenuItem
  • iptc_make_tag
  • is_AdminEditPage
  • is_connected
  • is_GalleryNewsType
  • is_News
  • is_NewsArchive
  • is_NewsArticle
  • is_NewsCategory
  • is_NewsPage
  • is_NewsType
  • is_Pages
  • is_valid_email_zp
  • is_valid_image
  • is_valid_other_type
  • is_zip
  • isAlbumClass
  • isAlbumPage
  • isArchive
  • isHandledAlbum
  • isImageClass
  • isImagePage
  • isImagePhoto
  • isImageVideo
  • isLandscape
  • isMyAlbum
  • isMyNews
  • isMyPage
  • isolate
  • isProtectedAlbum
  • isProtectedNewsCategory
  • isProtectedPage
  • isSubNewsCategoryOf
  • isValidURL
  • jQueryUpload_head
  • jQueryUpload_headers
  • jQueryUploadHandler
  • jQueryUploadHandler_admin_tabs
  • js_encode
  • json_decode
  • json_encode
  • kses
  • kses_array_lc
  • kses_attr
  • kses_bad_protocol
  • kses_bad_protocol_once
  • kses_bad_protocol_once2
  • kses_check_attr_val
  • kses_decode_entities
  • kses_hair
  • kses_hook
  • kses_html_error
  • kses_js_entities
  • kses_no_null
  • kses_normalize_entities
  • kses_normalize_entities2
  • kses_split
  • kses_split2
  • kses_stripslashes
  • kses_version
  • ksesProcess
  • layoutSelector
  • layoutSelector_album
  • listDBUses
  • listDirectoryFiles
  • listUses
  • load_zenpage_news
  • load_zenpage_pages
  • loadLocalOptions
  • log_message
  • lookupSortKey
  • macro_admin_tabs
  • macroList_show
  • makeAlbumCurrent
  • makeImageCurrent
  • makeSpecialImageName
  • markRelease_button
  • mb_strlen
  • mb_strpos
  • mb_strrpos
  • mb_strtolower
  • mb_strtoupper
  • mb_substr
  • mb_substr_count
  • menu_admin_toolbox_global
  • menu_tabs
  • minDiff
  • mkdir_recursive
  • my_truncate_string
  • myts_date
  • newAlbum
  • newImage
  • next_album
  • next_comment
  • next_image
  • next_news
  • next_page
  • ngettext_pl
  • ngettext_th
  • normalizeColumns
  • omsAdditions
  • openedForComments
  • parse_query
  • parse_size
  • parseAllowedTags
  • parseHttpAcceptLanguage
  • passAlbums
  • passImages
  • pathurlencode
  • PclZipUtilCopyBlock
  • PclZipUtilOptionText
  • PclZipUtilPathInclusion
  • PclZipUtilPathReduction
  • PclZipUtilRename
  • PclZipUtilTranslateWinPath
  • PHPMailerAutoload
  • populateManagedObjectsList
  • postAlbumSort
  • postIndexDecode
  • postIndexEncode
  • prefix
  • prepareAlbumPage
  • prepareCustomPage
  • prepareImagePage
  • prepareIndexPage
  • print404status
  • print_language_string_list
  • printAddToFavorites
  • printAdminFooter
  • printAdminHeader
  • printAdminRightsTable
  • printAdminToolbox
  • printAlbumBreadcrumb
  • printAlbumButtons
  • printAlbumCustomData
  • printAlbumData
  • printAlbumDate
  • printAlbumDesc
  • printAlbumEditForm
  • printAlbumEditRow
  • printAlbumLegend
  • printAlbumLink
  • printAlbumLocation
  • printAlbumMap
  • printAlbumMenu
  • printAlbumMenuJump
  • printAlbumMenuList
  • printAlbumMenuListAlbum
  • printAlbumPlace
  • printAlbumRating
  • printAlbumsSelector
  • printAlbumStatistic
  • printAlbumStatisticItem
  • printAlbumThumbImage
  • printAlbumTitle
  • printAlbumURL
  • printAlbumZip
  • printAllDates
  • printAllNewsCategories
  • printAllTags
  • printAllTagsAs
  • printAllTagsFromAlbum
  • printAllTagsFromZenpage
  • printAnnotatedAlbumTitle
  • printAnnotatedImageTitle
  • printArticleCategories
  • printArticleDatesDropdown
  • printArticlesPerPageDropdown
  • printBareAlbumDesc
  • printBareAlbumTitle
  • printBareGalleryDesc
  • printBareGalleryTitle
  • printBareImageDesc
  • printBareImageTitle
  • printBareNewsTitle
  • printBarePageTitle
  • printBulkActions
  • printCaptcha
  • printCategoriesStatistic
  • printCategoryCheckboxListEntry
  • printCategoryDropdown
  • printCategoryListSortableTable
  • printCategorySelection
  • printCodeblock
  • printCodeblockEdit
  • printCommentAuthorLink
  • printCommentErrors
  • printCommentForm
  • printContactForm
  • printCurrentNewsArchive
  • printCurrentNewsCategory
  • printCustomAlbumThumbImage
  • printCustomAlbumThumbMaxSpace
  • printCustomMenu
  • printCustomPageSelector
  • printCustomPageURL
  • printCustomSizedImage
  • printCustomSizedImageMaxHeight
  • printCustomSizedImageMaxSpace
  • printCustomSizedImageThumbMaxSpace
  • printDefaultSizedImage
  • printDownloadAlbumZipURL
  • printDownloadLink
  • printDownloadLinkAlbumZip
  • printdownloadList
  • printDownloadURL
  • printEditable
  • printEditCommentLink
  • printEditDropdown
  • printExpired
  • printFavoritesLink
  • printFavoritesURL
  • printField
  • printGalleryDesc
  • printGalleryIndexURL
  • printGalleryTitle
  • printGoogleMap
  • printHeadTitle
  • printHomeLink
  • printImageCustomData
  • printImageData
  • printImageDate
  • printImageDesc
  • printImageDiv
  • printImageEXIFData
  • printImageID
  • printImageLink
  • printImageMap
  • printImageMetadata
  • printImageRating
  • printImageSortOrder
  • printImageStatistic
  • printImageThumb
  • printImageTitle
  • printImageURL
  • printItemEditLink
  • printItemsList
  • printItemsListTable
  • printItemStatusDropdown
  • printjCarouselThumbNav
  • printjPlayerPlaylist
  • printLanguageSelector
  • printLatestAlbums
  • printLatestComments
  • printLatestImages
  • printLatestImagesByDate
  • printLatestImagesByMtime
  • printLatestNews
  • printLatestUpdatedAlbums
  • printLatestZenpageComments
  • printLink
  • printLinkHTML
  • printLogoAndLinks
  • printManagedObjects
  • printMenuemanagerPageList
  • printMenuemanagerPageListWithNav
  • printMenumanagerBreadcrumb
  • printMenumanagerNextLink
  • printMenumanagerPrevLink
  • printMostPopularItems
  • printMostRatedAlbums
  • printMostRatedImages
  • printMostRatedItems
  • printNestedAlbumsList
  • printNestedItemsList
  • printNestedMenu
  • printNews
  • printNewsArchive
  • printNewsAuthor
  • printNewsCategories
  • printNewsCategoryCustomData
  • printNewsCategoryDesc
  • printNewsCategoryURL
  • printNewsContent
  • printNewsCustomData
  • printNewsDate
  • printNewsExtraContent
  • printNewsImageTags
  • printNewsIndexURL
  • printNewsLink
  • printNewsPageList
  • printNewsPageListWithNav
  • printNewsReadMoreLink
  • printNewsStatistic
  • printNewsTitle
  • printNewsTitleLink
  • printNewsURL
  • printNextNewsLink
  • printNextNewsPageLink
  • printNextPageLink
  • printNextPageURL
  • printPageArticleTags
  • printPageAuthor
  • printPageContent
  • printPageCustomData
  • printPageDate
  • printPagedThumbsNav
  • printPageExtraContent
  • printPageID
  • printPageLastChangeDate
  • printPageLinkURL
  • printPageList
  • printPageListWithNav
  • printPageMenu
  • printPageNav
  • printPageSelector
  • printPagesListTable
  • printPagesStatistic
  • printPageTitle
  • printPageTitleLink
  • printPageURL
  • printParentBreadcrumb
  • printParentPagesBreadcrumb
  • printPasswordForm
  • printPopularAlbums
  • printPopularImages
  • printPreloadScript
  • printPrevNewsLink
  • printPrevNewsPageLink
  • printPrevPageLink
  • printPrevPageURL
  • printPublished
  • printPublishIconLink
  • printRandomImages
  • printRating
  • printRegisterURL
  • printRegistrationForm
  • printRelatedItems
  • printRSSHeaderLink
  • printRSSLink
  • printSearchBreadcrumb
  • printSearchForm
  • printSiteHomeURL
  • printSizedImageLink
  • printSizedImageURL
  • printSlideShow
  • printSlideShowJS
  • printSlideShowLink
  • printSortableHead
  • printSortOrderDropdown
  • printSubPagesExcerpts
  • printSubtabs
  • printTabs
  • printTags
  • printThumbNav
  • printTopRatedAlbums
  • printTopRatedImages
  • printTopRatedItems
  • printUnpublishedDropdown
  • printUserLogin_out
  • printUserSizeImage
  • printUserSizeSelector
  • printVersion
  • printZenJavascripts
  • printZenpageIconLegend
  • printZenpageItemsBreadcrumb
  • printZenpageNewsCategorySelector
  • printZenpagePagesSelector
  • printZenpageRSSHeaderLink
  • printZenpageRSSLink
  • printZenpageStatistic
  • printZenphotoLink
  • process_language_string_save
  • processAlbumBulkActions
  • processAlbumEdit
  • processCodeblockSave
  • processCommentBulkActions
  • processCredentials
  • processCustomOptionSave
  • processEditSelection
  • processExpired
  • processImageBulkActions
  • processImageEdit
  • processManagedObjects
  • processMenuBulkActions
  • processOrder
  • processRights
  • processTags
  • processZenpageBulkActions
  • propSizes
  • publishItem
  • purgeOption
  • query
  • query_full_array
  • query_single_row
  • rc4
  • read_exif_data_protected
  • readTags
  • recaptcha_check_answer
  • recaptcha_get_html
  • recaptcha_get_signup_url
  • recaptcha_mailhide_html
  • recaptcha_mailhide_url
  • reconfigureAction
  • reconfigureCS
  • reconfigurePage
  • recordMissing
  • rem_context
  • removeParentAlbumNames
  • resetCurrentAlbum
  • restore_context
  • reveal
  • rewrite_get_album_image
  • rewrite_path
  • rewrite_path_zenpage
  • RSS_Channel
  • RSS_Retrieve
  • RSS_Tags
  • rulesList
  • run
  • safe_fnmatch
  • safe_glob
  • sanitize
  • sanitize_numeric
  • sanitize_path
  • sanitize_script
  • sanitize_string
  • sanitizeRedirect
  • save_context
  • saveLayoutSelection
  • saveZenphotoLayoutSelection
  • search_quote
  • secureServer
  • seo_cleanup_button
  • seoFriendly
  • seoFriendlyJS
  • set_context
  • setAlbumCustomData
  • setAlbumSubtabs
  • setImageCustomData
  • setMainDomain
  • setOption
  • setOptionDefault
  • setPluginDomain
  • setThemeColumns
  • setThemeDomain
  • setThemeOption
  • setThemeOptionDefault
  • setupAllowedMaps
  • setupCurrentLocale
  • setupDomain
  • setupTheme
  • shortenContent
  • showOrNotShowField
  • shuffle_assoc
  • signatureChange
  • site_upgrade_button
  • site_upgrade_status
  • sitemap_echonl
  • sitemap_getChangefreq
  • sitemap_getDateformat
  • sitemap_getDBLimit
  • sitemap_getISO8601Date
  • skipScheduledPublishing
  • sortByKey
  • sortByMultilingual
  • sortMultiArray
  • standardScripts
  • standardThemeOptions
  • stickyNews
  • storeConfig
  • storeTags
  • stripSuffix
  • submenuOf
  • switchLog
  • tagSelector
  • tagSuggestJS
  • tagSuggestJS_admin
  • tagSuggestJS_frontend
  • themeIsEditable
  • themeSetup
  • timezoneDiff
  • tinymce4ConfigJS
  • truncate_string
  • unpublishedZenphotoItemCheck
  • unpublishSubalbums
  • unQuote
  • unzip
  • updateArticle
  • updateCacheName
  • updateCategory
  • updateConfigItem
  • updateItemSortorder
  • updateItemsSortorder
  • updateMenuItem
  • updatePage
  • upload_extra
  • upload_form
  • upload_head
  • user_mailing_list_button
  • validateLocale
  • wordpress_import_button
  • wp_prefix
  • wp_query_full_array
  • wpimport_TryAgainError
  • XSRFdefender
  • XSRFToken
  • zenJavascript
  • zenpageAlbumImage
  • zenpageBulkActionMessage
  • zenpageHitcounter
  • zenpageJSCSS
  • zenpageOpenedForComments
  • zenpagePublish
  • zenphoto_PHPMailer
  • zenphoto_sendmail
  • zenPhotoTheme
  • zp_apply_filter
  • zp_clearCookie
  • zp_colorAllocate
  • zp_cookieEncode
  • zp_copyCanvas
  • zp_createImage
  • zp_drawRectangle
  • zp_error
  • zp_filter_slot
  • zp_filter_unique_id
  • zp_getCookie
  • zp_getFonts
  • zp_graphicsLibInfo
  • zp_handle_password
  • zp_handle_password_single
  • zp_has_filter
  • zp_image_types
  • zp_imageCanRotate
  • zp_imageColorTransparent
  • zp_imageDims
  • zp_imageFill
  • zp_imageFontHeight
  • zp_imageFontWidth
  • zp_imageFromString
  • zp_imageGet
  • zp_imageGray
  • zp_imageHeight
  • zp_imageIPTC
  • zp_imageKill
  • zp_imageLoadFont
  • zp_imageMerge
  • zp_imageOutput
  • zp_imageResizeAlpha
  • zp_imageUnsharpMask
  • zp_imageWidth
  • zp_load_album
  • zp_load_gallery
  • zp_load_image
  • zp_load_page
  • zp_load_request
  • zp_load_search
  • zp_loggedin
  • zp_mail
  • zp_register_filter
  • zp_remove_filter
  • zp_resampleImage
  • zp_rotateImage
  • zp_session_start
  • zp_setCookie
  • zp_writeString
  • zpErrorHandler
  • zpFormattedDate
  • zpRewriteURL
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
   1: <?php
   2: 
   3: /**
   4:  * Image Class
   5:  * @package classes
   6:  */
   7: // force UTF-8 Ø
   8: 
   9: $_zp_extra_filetypes = array(); // contains file extensions and the handler class for alternate images
  10: 
  11: define('WATERMARK_IMAGE', 1);
  12: define('WATERMARK_THUMB', 2);
  13: define('WATERMARK_FULL', 4);
  14: 
  15: /**
  16:  * Returns a new "image" object based on the file extension
  17:  *
  18:  * @param object $album the owner album
  19:  * @param string $filename the filename
  20:  * @param bool $quiet set true to supress error messages (used by loadimage)
  21:  * @return object
  22:  */
  23: function newImage($album, $filename, $quiet = false) {
  24:     global $_zp_extra_filetypes, $_zp_missing_image;
  25:     if (is_array($filename)) {
  26:         $xalbum = newAlbum($filename['folder'], true, true);
  27:         $filename = $filename['filename'];
  28:     } else {
  29:         if ($album->isDynamic()) {
  30:             $xalbum = NULL;
  31:             foreach ($album->getImages() as $image) {
  32:                 if ($filename == $image['filename']) {
  33:                     $xalbum = newAlbum($image['folder']);
  34:                     break;
  35:                 }
  36:             }
  37:         } else {
  38:             $xalbum = $album;
  39:         }
  40:     }
  41:     if (!is_object($xalbum) || !$xalbum->exists || !isAlbumClass($xalbum)) {
  42:         if (!$quiet) {
  43:             $msg = sprintf(gettext('Bad album object parameter to newImage(%s)'), $filename);
  44:             trigger_error($msg, E_USER_NOTICE);
  45:         }
  46:         return $_zp_missing_image;
  47:     }
  48:     if ($object = Gallery::validImageAlt($filename)) {
  49:         $image = New $object($xalbum, $filename, $quiet);
  50:     } else {
  51:         if (Gallery::validImage($filename)) {
  52:             $image = New Image($xalbum, $filename, $quiet);
  53:         } else {
  54:             $image = NULL;
  55:         }
  56:     }
  57:     if ($image) {
  58:         if ($album && $album->isDynamic()) {
  59:             $image->albumname = $album->name;
  60:             $image->albumlink = $album->linkname;
  61:             $image->albumnamealbum = $album;
  62:         }
  63:         zp_apply_filter('image_instantiate', $image);
  64:         if ($image->exists) {
  65:             return $image;
  66:         } else {
  67:             return $_zp_missing_image;
  68:         }
  69:     }
  70: 
  71:     if (!$quiet) {
  72:         $msg = sprintf(gettext('Bad filename suffix in newImage(%s)'), $filename);
  73:         trigger_error($msg, E_USER_NOTICE);
  74:     }
  75:     return $_zp_missing_image;
  76: }
  77: 
  78: /**
  79:  * Returns true if the object is a zenphoto 'image'
  80:  *
  81:  * @param object $image
  82:  * @return bool
  83:  */
  84: function isImageClass($image = NULL) {
  85:     global $_zp_current_image;
  86:     if (is_null($image)) {
  87:         if (!in_context(ZP_IMAGE))
  88:             return false;
  89:         $image = $_zp_current_image;
  90:     }
  91:     return is_object($image) && ($image->table == 'images');
  92: }
  93: 
  94: /**
  95:  * handles 'picture' images
  96:  */
  97: class Image extends MediaObject {
  98: 
  99:     var $filename; // true filename of the image.
 100:     var $exists = true; // Does the image exist?
 101:     var $webpath; // The full URL path to the original image.
 102:     var $localpath; // Latin1 full SERVER path to the original image.
 103:     var $displayname; // $filename with the extension stripped off.
 104:     var $album; // An album object for the album containing this image.
 105:     var $albumname; // The name of the album for which this image was instantiated. (MAY NOT be $this->album->name!!!!).
 106:     var $albumnamealbum; // An album object representing the above;
 107:     var $albumlink; // "rewrite" verwion of the album name, eg. may not have the .alb
 108:     var $imagefolder; // The album folder containing the image (May be different from the albumname!!!!)
 109:     protected $index; // The index of the current image in the album array.
 110:     protected $sortorder; // The position that this image should be shown in the album
 111:     var $filemtime; // Last modified time of this image
 112:     var $sidecars = array(); // keeps the list of suffixes associated with this image
 113:     var $manage_rights = MANAGE_ALL_ALBUM_RIGHTS;
 114:     var $manage_some_rights = ALBUM_RIGHTS;
 115:     var $view_rights = ALL_ALBUMS_RIGHTS;
 116:     // Plugin handler support
 117:     var $objectsThumb = NULL; // Thumbnail image for the object
 118: 
 119:     /**
 120:      * Constructor for class-image
 121:      *
 122:      * Do not call this constructor directly unless you really know what you are doing!
 123:      * Use instead the function newImage() which will instantiate an object of the
 124:      * correct class for the file type.
 125:      *
 126:      * @param object &$album the owning album
 127:      * @param sting $filename the filename of the image
 128:      * @return Image
 129:      */
 130: 
 131:     function __construct($album, $filename, $quiet = false) {
 132:         global $_zp_current_admin_obj;
 133:         // $album is an Album object; it should already be created.
 134:         $msg = false;
 135:         if (!is_object($album) || !$album->exists) {
 136:             $msg = gettext('Invalid image instantiation: Album does not exist');
 137:         } else {
 138:             if (!$this->classSetup($album, $filename) || !file_exists($this->localpath) || is_dir($this->localpath)) {
 139:                 $msg = gettext('Invalid image instantiation: file does not exist');
 140:             }
 141:         }
 142:         if ($msg) {
 143:             $this->exists = false;
 144:             if (!$quiet) {
 145:                 trigger_error($msg, E_USER_ERROR);
 146:             }
 147:             return;
 148:         }
 149: 
 150:         // This is where the magic happens...
 151:         $album_name = $album->name;
 152:         $new = $this->instantiate('images', array('filename' => $filename, 'albumid' => $this->album->getID()), 'filename', false, empty($album_name));
 153:         if ($new || $this->filemtime != $this->get('mtime')) {
 154:             if ($new)
 155:                 $this->setTitle($this->displayname);
 156:             $this->updateMetaData(); // extract info from image
 157:             $this->updateDimensions(); // deal with rotation issues
 158:             $this->set('mtime', $this->filemtime);
 159:             $this->save();
 160:             if ($new)
 161:                 zp_apply_filter('new_image', $this);
 162:         }
 163:     }
 164: 
 165:     /**
 166:      * (non-PHPdoc)
 167:      * @see PersistentObject::setDefaults()
 168:      */
 169:     protected function setDefaults() {
 170:         global $_zp_gallery;
 171:         $this->setShow($_zp_gallery->getImagePublish());
 172:         $this->set('mtime', $this->filemtime);
 173:         $this->updateDimensions(); // deal with rotation issues
 174:     }
 175: 
 176:     /**
 177:      * generic "image" class setup code
 178:      * Returns true if valid image.
 179:      *
 180:      * @param object $album the images' album
 181:      * @param string $filename of the image
 182:      * @return bool
 183:      *
 184:      */
 185:     protected function classSetup(&$album, $filename) {
 186:         if (TEST_RELEASE) {
 187:             $bt = debug_backtrace();
 188:             $good = false;
 189:             foreach ($bt as $b) {
 190:                 if ($b['function'] == "newImage") {
 191:                     $good = true;
 192:                     break;
 193:                 }
 194:             }
 195:             if (!$good) {
 196:                 zp_error(gettext('An image object was instantiated without using the newImage() function.'), E_USER_WARNING);
 197:             }
 198:         }
 199: 
 200:         global $_zp_current_admin_obj;
 201:         $fileFS = internalToFilesystem($filename);
 202:         if ($filename != filesystemToInternal($fileFS)) { // image name spoof attempt
 203:             return false;
 204:         }
 205:         $this->albumnamealbum = $this->album = &$album;
 206:         if ($album->name == '') {
 207:             $this->webpath = ALBUM_FOLDER_WEBPATH . $filename;
 208:             $this->encwebpath = ALBUM_FOLDER_WEBPATH . rawurlencode($filename);
 209:             $this->localpath = ALBUM_FOLDER_SERVERPATH . internalToFilesystem($filename);
 210:         } else {
 211:             $this->webpath = ALBUM_FOLDER_WEBPATH . $album->name . "/" . $filename;
 212:             $this->encwebpath = ALBUM_FOLDER_WEBPATH . pathurlencode($album->name) . "/" . rawurlencode($filename);
 213:             $this->localpath = $album->localpath . $fileFS;
 214:         }
 215:         $this->imagefolder = $this->albumlink = $this->albumname = $album->name;
 216:         $this->filename = $filename;
 217:         $this->displayname = substr($this->filename, 0, strrpos($this->filename, '.'));
 218:         if (empty($this->displayname))
 219:             $this->displayname = $this->filename;
 220:         $this->comments = null;
 221:         $this->filemtime = @filemtime($this->localpath);
 222:         $this->imagetype = strtolower(get_class($this)) . 's';
 223:         $date = $this->get('date');
 224:         if (empty($date)) {
 225:             $this->set('date', strftime('%Y-%m-%d %H:%M:%S', $this->filemtime));
 226:         }
 227:         return true;
 228:     }
 229: 
 230:     /**
 231:      * Returns the image filename
 232:      *
 233:      * @return string
 234:      */
 235:     function getFileName() {
 236:         return $this->filename;
 237:     }
 238: 
 239:     /**
 240:      * Returns true if the file has changed since last time we looked
 241:      *
 242:      * @return bool
 243:      */
 244:     protected function fileChanged() {
 245:         $storedmtime = $this->get('mtime');
 246:         return (empty($storedmtime) || $this->filemtime > $storedmtime);
 247:     }
 248: 
 249:     /**
 250:      * Returns an array of EXIF data
 251:      *
 252:      * @return array
 253:      */
 254:     function getMetaData() {
 255:         global $_zp_exifvars;
 256:         $exif = array();
 257:         // Put together an array of EXIF data to return
 258:         foreach ($_zp_exifvars as $field => $exifvar) {
 259:             //  only enabled image metadata
 260:             if ($_zp_exifvars[$field][5]) {
 261:                 $exif[$field] = $this->get($field);
 262:             }
 263:         }
 264:         return $exif;
 265:     }
 266: 
 267:     /**
 268:      * Parses Exif/IPTC data
 269:      *
 270:      */
 271:     function updateMetaData() {
 272:         global $_zp_exifvars, $_zp_gallery;
 273:         require_once(dirname(__FILE__) . '/exif/exif.php');
 274:         $IPTCtags = array(
 275:                         'SKIP'                               => '2#000', // Record Version                                      Size:64
 276:                         'ObjectType'                     => '2#003', // Object Type Ref                                     Size:67
 277:                         'ObjectAttr'                     => '2#004', // Object Attribute Ref                            Size:67
 278:                         'ObjectName'                     => '2#005', // Object name                                             Size:64
 279:                         'EditStatus'                     => '2#007', // Edit Status                                             Size:64
 280:                         'EditorialUpdate'            => '2#008', // Editorial Update                                    Size:2
 281:                         'Urgency'                            => '2#010', // Urgency                                                     Size:1
 282:                         'SubRef'                             => '2#012', // Subject Reference                                   Size:236
 283:                         'Category'                       => '2#015', // Category                                                    Size:3
 284:                         'SuppCategory'               => '2#020', // Supplemental category                           Size:32
 285:                         'FixtureID'                      => '2#022', // Fixture ID                                              Size:32
 286:                         'Keywords'                       => '2#025', // Keywords                                                    Size:64
 287:                         'ContentLocationCode'    => '2#026', // Content Location Code                           Size:3
 288:                         'ContentLocationName'    => '2#027', // Content Location Name                           Size:64
 289:                         'ReleaseDate'                    => '2#030', // Release Date                                            Size:8
 290:                         'ReleaseTime'                    => '2#035', // Release Time                                            Size:11
 291:                         'ExpireDate'                     => '2#037', // Expiration Date                                     Size:8
 292:                         'ExpireTime'                     => '2#038', // Expiration Time                                     Size:11
 293:                         'SpecialInstru'              => '2#040', // Special Instructions                            Size:256
 294:                         'ActionAdvised'              => '2#042', // Action Advised                                      Size:2
 295:                         'RefService'                     => '2#045', // Reference Service                                   Size:10
 296:                         'RefDate'                            => '2#047', // Reference Date                                      Size:8
 297:                         'RefNumber'                      => '2#050', // Reference Number                                    Size:8
 298:                         'DateCreated'                    => '2#055', // Date created                                            Size:8
 299:                         'TimeCreated'                    => '2#060', // Time created                                            Size:11
 300:                         'DigitizeDate'               => '2#062', // Digital Creation Date                           Size:8
 301:                         'DigitizeTime'               => '2#063', // Digital Creation Time                           Size:11
 302:                         'OriginatingProgram'     => '2#065', // Originating Program                             Size:32
 303:                         'ProgramVersion'             => '2#070', // Program version                                     Size:10
 304:                         'ObjectCycle'                    => '2#075', // Object Cycle                                            Size:1
 305:                         'ByLine'                             => '2#080', // ByLine                                                      Size:32
 306:                         'ByLineTitle'                    => '2#085', // ByLine Title                                            Size:32
 307:                         'City'                               => '2#090', // City                                                            Size:32
 308:                         'SubLocation'                    => '2#092', // Sublocation                                             Size:32
 309:                         'State'                              => '2#095', // Province/State                                      Size:32
 310:                         'LocationCode'               => '2#100', // Country/Primary Location Code           Size:3
 311:                         'LocationName'               => '2#101', // Country/Primary Location Name           Size:64
 312:                         'TransmissionRef'            => '2#103', // Original Transmission Reference     Size:32
 313:                         'ImageHeadline'              => '2#105', // Image headline                                      Size:256
 314:                         'ImageCredit'                    => '2#110', // Image credit                                            Size:32
 315:                         'Source'                             => '2#115', // Source                                                      Size:32
 316:                         'Copyright'                      => '2#116', // Copyright Notice                                    Size:128
 317:                         'Contact'                            => '2#118', // Contact                                                     Size:128
 318:                         'ImageCaption'               => '2#120', // Image caption                                           Size:2000
 319:                         'ImageCaptionWriter'     => '2#122', // Image caption writer                            Size:32
 320:                         'ImageType'                      => '2#130', // Image type                                              Size:2
 321:                         'Orientation'                    => '2#131', // Image    rientation                                 Size:1
 322:                         'LangID'                             => '2#135', // Language ID                                             Size:3
 323:                         'Subfile'                            => '8#010' //  Subfile                                                     Size:2
 324:         );
 325:         $this->set('hasMetadata', 0);
 326:         $result = array();
 327:         if (get_class($this) == 'Image') {
 328:             $localpath = $this->localpath;
 329:         } else {
 330:             $localpath = $this->getThumbImageFile();
 331:         }
 332:         $xdate = false;
 333: 
 334:         if (!empty($localpath)) { // there is some kind of image to get metadata from
 335:             $exifraw = read_exif_data_protected($localpath);
 336:             if (isset($exifraw['ValidEXIFData'])) {
 337:                 $this->set('hasMetadata', 1);
 338:                 foreach ($_zp_exifvars as $field => $exifvar) {
 339:                     $exif = NULL;
 340:                     if ($exifvar[5]) { // enabled field
 341:                         if (isset($exifraw[$exifvar[0]][$exifvar[1]])) {
 342:                             $exif = trim(sanitize($exifraw[$exifvar[0]][$exifvar[1]], 1));
 343:                         } else if (isset($exifraw[$exifvar[0]]['MakerNote'][$exifvar[1]])) {
 344:                             $exif = trim(sanitize($exifraw[$exifvar[0]]['MakerNote'][$exifvar[1]], 1));
 345:                         }
 346:                     }
 347:                     $this->set($field, $exif);
 348:                 }
 349:             }
 350:             /* check IPTC data */
 351:             $iptcdata = zp_imageIPTC($localpath);
 352:             if (!empty($iptcdata)) {
 353:                 $iptc = iptcparse($iptcdata);
 354:                 if ($iptc) {
 355:                     $this->set('hasMetadata', 1);
 356:                     $characterset = $this->getIPTCTag('1#090', $iptc);
 357:                     if (!$characterset) {
 358:                         $characterset = getOption('IPTC_encoding');
 359:                     } else if (substr($characterset, 0, 1) == chr(27)) { // IPTC escape encoding
 360:                         $characterset = substr($characterset, 1);
 361:                         if ($characterset == '%G') {
 362:                             $characterset = 'UTF-8';
 363:                         } else { // we don't know, need to understand the IPTC standard here. In the mean time, default it.
 364:                             $characterset = getOption('IPTC_encoding');
 365:                         }
 366:                     } else if ($characterset == 'UTF8') {
 367:                         $characterset = 'UTF-8';
 368:                     }
 369:                     // Extract IPTC fields of interest
 370:                     foreach ($_zp_exifvars as $field => $exifvar) {
 371:                         if ($exifvar[0] == 'IPTC') {
 372:                             if ($exifvar[5]) { // enabled field
 373:                                 $datum = $this->getIPTCTag($IPTCtags[$exifvar[1]], $iptc);
 374:                                 $this->set($field, $this->prepIPTCString($datum, $characterset));
 375:                             } else {
 376:                                 $this->set($field, NULL);
 377:                             }
 378:                         }
 379:                     }
 380:                     /* iptc keywords (tags) */
 381:                     if ($_zp_exifvars['IPTCKeywords'][5]) {
 382:                         $datum = $this->getIPTCTagArray($IPTCtags['Keywords'], $iptc);
 383:                         if (is_array($datum)) {
 384:                             $tags = array();
 385:                             $result['tags'] = array();
 386:                             foreach ($datum as $item) {
 387:                                 $tags[] = $this->prepIPTCString(sanitize($item, 3), $characterset);
 388:                             }
 389:                             $this->setTags($tags);
 390:                         }
 391:                     }
 392:                 }
 393:             }
 394:         }
 395:         /* "import" metadata into Zenphoto fields as makes sense */
 396:         zp_apply_filter('image_metadata', $this);
 397: 
 398:         /* iptc date */
 399:         $date = $this->get('IPTCDateCreated');
 400:         if (!empty($date)) {
 401:             if (strlen($date) > 8) {
 402:                 $time = substr($date, 8);
 403:             } else {
 404:                 /* got date from IPTC, now must get time */
 405:                 $time = $this->get('IPTCTimeCreated');
 406:             }
 407:             $date = substr($date, 0, 4) . '-' . substr($date, 4, 2) . '-' . substr($date, 6, 2);
 408:             if (!empty($time)) {
 409:                 $date = $date . ' ' . substr($time, 0, 2) . ':' . substr($time, 2, 2) . ':' . substr($time, 4, 2);
 410:             }
 411:         }
 412:         /* EXIF date */
 413:         if (empty($date)) {
 414:             $date = $this->get('EXIFDateTime');
 415:         }
 416:         if (empty($date)) {
 417:             $date = $this->get('EXIFDateTimeOriginal');
 418:         }
 419:         if (empty($date)) {
 420:             $date = $this->get('EXIFDateTimeDigitized');
 421:         }
 422:         if (!empty($date)) {
 423:             $xdate = $date;
 424:             $this->setDateTime($date);
 425:         }
 426: 
 427:         /* iptc title */
 428:         $title = $this->get('IPTCObjectName');
 429:         if (empty($title)) {
 430:             $title = $this->get('IPTCImageHeadline');
 431:         }
 432:         //EXIF title [sic]
 433:         if (empty($title)) {
 434:             $title = $this->get('EXIFDescription');
 435:         }
 436:         if (!empty($title)) {
 437:             $this->setTitle($title);
 438:         }
 439: 
 440:         /* iptc description */
 441:         $desc = $this->get('IPTCImageCaption');
 442:         if (!empty($desc)) {
 443:    if(getOption('IPTC_convert_linebreaks')) {
 444:      $desc = nl2br($desc);
 445:    }
 446:             $this->setDesc($desc);
 447:         }
 448: 
 449:         /* iptc location, state, country */
 450:         $loc = $this->get('IPTCSubLocation');
 451:         if (!empty($loc)) {
 452:             $this->setLocation($loc);
 453:         }
 454:         $city = $this->get('IPTCCity');
 455:         if (!empty($city)) {
 456:             $this->setCity($city);
 457:         }
 458:         $state = $this->get('IPTCState');
 459:         if (!empty($state)) {
 460:             $this->setState($state);
 461:         }
 462:         $country = $this->get('IPTCLocationName');
 463:         if (!empty($country)) {
 464:             $this->setCountry($country);
 465:         }
 466: 
 467:         /* iptc credit */
 468:         $credit = $this->get('IPTCByLine');
 469:         if (empty($credit)) {
 470:             $credit = $this->get('IPTCImageCredit');
 471:         }
 472:         if (empty($credit)) {
 473:             $credit = $this->get('IPTCSource');
 474:         }
 475:         if (!empty($credit)) {
 476:             $this->setCredit($credit);
 477:         }
 478: 
 479:         /* iptc copyright */
 480:         $this->setCopyright($this->get('IPTCCopyright'));
 481: 
 482:         if (empty($xdate)) {
 483:             $this->setDateTime(strftime('%Y-%m-%d %H:%M:%S', $this->filemtime));
 484:         }
 485:         $alb = $this->album;
 486:         if (!is_null($alb)) {
 487:             if (!$this->get('owner')) {
 488:                 $this->setOwner($alb->getOwner());
 489:             }
 490:             $save = false;
 491:             if (strtotime($alb->getUpdatedDate()) < strtotime($this->getDateTime())) {
 492:                 $alb->setUpdatedDate($this->getDateTime());
 493:                 $save = true;
 494:             }
 495:             if (is_null($albdate = $alb->getDateTime()) || ($_zp_gallery->getAlbumUseImagedate() && strtotime($albdate) < strtotime($this->getDateTime()))) {
 496:                 $alb->setDateTime($this->getDateTime()); //  not necessarily the right one, but will do. Can be changed in Admin
 497:                 $save = true;
 498:             }
 499:             if ($save) {
 500:                 $alb->save();
 501:             }
 502:         }
 503:     }
 504: 
 505:     /**
 506:      * Fetches a single tag from IPTC data
 507:      *
 508:      * @param string $tag the metadata tag sought
 509:      * @return string
 510:      */
 511:     private function getIPTCTag($tag, $iptc) {
 512:         if (isset($iptc[$tag])) {
 513:             $iptcTag = $iptc[$tag];
 514:             $r = "";
 515:             $ct = count($iptcTag);
 516:             for ($i = 0; $i < $ct; $i++) {
 517:                 $w = $iptcTag[$i];
 518:                 if (!empty($r)) {
 519:                     $r .= ", ";
 520:                 }
 521:                 $r .= $w;
 522:             }
 523:             return trim($r);
 524:         }
 525:         return '';
 526:     }
 527: 
 528:     /**
 529:      * Fetches the IPTC array for a single tag.
 530:      *
 531:      * @param string $tag the metadata tag sought
 532:      * @return array
 533:      */
 534:     private function getIPTCTagArray($tag, $iptc) {
 535:         if (array_key_exists($tag, $iptc)) {
 536:             return $iptc[$tag];
 537:         }
 538:         return NULL;
 539:     }
 540: 
 541:     /**
 542:      * Returns the IPTC data converted into UTF8
 543:      *
 544:      * @param string $iptcstring the IPTC data
 545:      * @param string $characterset the internal encoding of the data
 546:      * @return string
 547:      */
 548:     private function prepIPTCString($iptcstring, $characterset) {
 549:         global $_zp_UTF8;
 550:         // Remove null byte at the end of the string if it exists.
 551:         if (substr($iptcstring, -1) === 0x0) {
 552:             $iptcstring = substr($iptcstring, 0, -1);
 553:         }
 554:         $outputset = LOCAL_CHARSET;
 555:         if ($characterset == $outputset)
 556:             return $iptcstring;
 557:         $iptcstring = $_zp_UTF8->convert($iptcstring, $characterset, $outputset);
 558:         return trim(sanitize($iptcstring, 1));
 559:     }
 560: 
 561:     /**
 562:      * Update this object's values for width and height.
 563:      *
 564:      */
 565:     function updateDimensions() {
 566:         $discard = NULL;
 567:         $size = zp_imageDims($this->localpath);
 568:         $width = $size['width'];
 569:         $height = $size['height'];
 570:         if (zp_imageCanRotate()) {
 571:             // Swap the width and height values if the image should be rotated
 572:             $splits = preg_split('/!([(0-9)])/', $this->get('EXIFOrientation'));
 573:             $rotation = $splits[0];
 574:             switch ($rotation) {
 575:                 case 5:
 576:                 case 6:
 577:                 case 7:
 578:                 case 8:
 579:                     $width = $size['height'];
 580:                     $height = $size['width'];
 581:                     break;
 582:             }
 583:         }
 584:         $this->set('width', $width);
 585:         $this->set('height', $height);
 586:     }
 587: 
 588:     /**
 589:      * Returns the width of the image
 590:      *
 591:      * @return int
 592:      */
 593:     function getWidth() {
 594:         $w = $this->get('width');
 595:         if (empty($w)) {
 596:             $this->updateDimensions();
 597:             $this->save();
 598:             $w = $this->get('width');
 599:         }
 600:         return $w;
 601:     }
 602: 
 603:     /**
 604:      * Returns the height of the image
 605:      *
 606:      * @return int
 607:      */
 608:     function getHeight() {
 609:         $h = $this->get('height');
 610:         if (empty($h)) {
 611:             $this->updateDimensions();
 612:             $this->save();
 613:             $h = $this->get('height');
 614:         }
 615:         return $h;
 616:     }
 617: 
 618:     /**
 619:      * Returns the album that holds this image
 620:      *
 621:      * @return object
 622:      */
 623:     function getAlbum() {
 624:         return $this->album;
 625:     }
 626: 
 627:     /**
 628:      * Retuns the folder name of the album that holds this image
 629:      *
 630:      * @return string
 631:      */
 632:     function getAlbumName() {
 633:         return $this->albumname;
 634:     }
 635: 
 636:     /**
 637:      * Returns the location field of the image
 638:      *
 639:      * @return string
 640:      */
 641:     function getLocation($locale = NULL) {
 642:         $text = $this->get('location');
 643:         if ($locale !== 'all') {
 644:             $text = get_language_string($text, $locale);
 645:         }
 646:         $text = zpFunctions::unTagURLs($text);
 647:         return $text;
 648:     }
 649: 
 650:     /**
 651:      * Stores the location field of the image
 652:      *
 653:      * @param string $location text for the location
 654:      */
 655:     function setLocation($location) {
 656:         $this->set('location', $location);
 657:     }
 658: 
 659:     /**
 660:      * Returns the city field of the image
 661:      *
 662:      * @return string
 663:      */
 664:     function getCity($locale = NULL) {
 665:         $text = $this->get('city');
 666:         if ($locale !== 'all') {
 667:             $text = get_language_string($text, $locale);
 668:         }
 669:         $text = zpFunctions::unTagURLs($text);
 670:         return $text;
 671:     }
 672: 
 673:     /**
 674:      * Stores the city field of the image
 675:      *
 676:      * @param string $city text for the city
 677:      */
 678:     function setCity($city) {
 679:         $this->set('city', zpFunctions::tagURLs($city));
 680:     }
 681: 
 682:     /**
 683:      * Returns the state field of the image
 684:      *
 685:      * @return string
 686:      */
 687:     function getState($locale = NULL) {
 688:         $text = $this->get('state');
 689:         if ($locale !== 'all') {
 690:             $text = get_language_string($text, $locale);
 691:         }
 692:         $text = zpFunctions::unTagURLs($text);
 693:         return $text;
 694:     }
 695: 
 696:     /**
 697:      * Stores the state field of the image
 698:      *
 699:      * @param string $state text for the state
 700:      */
 701:     function setState($state) {
 702:         $this->set('state', zpFunctions::tagURLs($state));
 703:     }
 704: 
 705:     /**
 706:      * Returns the country field of the image
 707:      *
 708:      * @return string
 709:      */
 710:     function getCountry($locale = NULL) {
 711:         $text = $this->get('country');
 712:         if ($locale !== 'all') {
 713:             $text = get_language_string($text, $locale);
 714:         }
 715:         $text = zpFunctions::unTagURLs($text);
 716:         return $text;
 717:     }
 718: 
 719:     /**
 720:      * Stores the country field of the image
 721:      *
 722:      * @param string $country text for the country filed
 723:      */
 724:     function setCountry($country) {
 725:         $this->set('country', zpFunctions::tagURLs($country));
 726:     }
 727: 
 728:     /**
 729:      * Returns the credit field of the image
 730:      *
 731:      * @return string
 732:      */
 733:     function getCredit($locale = NULL) {
 734:         $text = $this->get('credit');
 735:         if ($locale !== 'all') {
 736:             $text = get_language_string($text, $locale);
 737:         }
 738:         $text = zpFunctions::unTagURLs($text);
 739:         return $text;
 740:     }
 741: 
 742:     /**
 743:      * Stores the credit field of the image
 744:      *
 745:      * @param string $credit text for the credit field
 746:      */
 747:     function setCredit($credit) {
 748:         $this->set('credit', zpFunctions::tagURLs($credit));
 749:     }
 750: 
 751:     /**
 752:      * Returns the copyright field of the image
 753:      *
 754:      * @return string
 755:      */
 756:     function getCopyright($locale = NULL) {
 757:         $text = $this->get('copyright');
 758:         if ($locale !== 'all') {
 759:             $text = get_language_string($text, $locale);
 760:         }
 761:         $text = zpFunctions::unTagURLs($text);
 762:         return $text;
 763:     }
 764: 
 765:     /**
 766:      * Stores the text for the copyright field of the image
 767:      *
 768:      * @param string $copyright text for the copyright field
 769:      */
 770:     function setCopyright($copyright) {
 771:         $this->set('copyright', zpFunctions::tagURLs($copyright));
 772:     }
 773: 
 774:     /**
 775:    * Permanently delete this image (permanent: be careful!)
 776:    * Returns the result of the unlink operation (whether the delete was successful)
 777:    * @param bool $clean whether to remove the database entry.
 778:    * @return bool
 779:    */
 780:   function remove() {
 781:     $result = false;
 782:     if (parent::remove()) {
 783:       $result = true;
 784:       $filestodelete = safe_glob(substr($this->localpath, 0, strrpos($this->localpath, '.')) . '.*');
 785:       foreach ($filestodelete as $file) {
 786:         @chmod($file, 0777);
 787:         $result = $result && @unlink($file);
 788:       }
 789:       if ($result) {
 790:         query("DELETE FROM " . prefix('obj_to_tag') . "WHERE `type`='images' AND `objectid`=" . $this->id);
 791:         query("DELETE FROM " . prefix('comments') . "WHERE `type` ='images' AND `ownerid`=" . $this->id);
 792:         $cachepath = SERVERCACHE . '/' . pathurlencode($this->album->name) . '/' . $this->filename;
 793:         $cachefilestodelete = safe_glob(substr($cachepath, 0, strrpos($cachepath, '.')) . '_*');
 794:         foreach ($cachefilestodelete as $file) {
 795:           @chmod($file, 0777);
 796:           @unlink($file);
 797:         }
 798:       }
 799:     }
 800:     clearstatcache();
 801:     return $result;
 802:   }
 803: 
 804:   /**
 805:      * Moves an image to a new album and/or filename (rename).
 806:      * Returns  0 on success and error indicator on failure.
 807:      * @param Album $newalbum the album to move this file to. Must be a valid Album object.
 808:      * @param string $newfilename the new file name of the image in the specified album.
 809:      * @return int
 810:      */
 811:     function move($newalbum, $newfilename = null) {
 812:         if (is_string($newalbum))
 813:             $newalbum = newAlbum($newalbum, false);
 814:         if ($newfilename == null) {
 815:             $newfilename = $this->filename;
 816:         } else {
 817:             if (getSuffix($this->filename) != getSuffix($newfilename)) { // that is a no-no
 818:                 return 6;
 819:             }
 820:         }
 821:         if ($newalbum->getID() == $this->album->getID() && $newfilename == $this->filename) {
 822:             // Nothing to do - moving the file to the same place.
 823:             return 2;
 824:         }
 825:         $newpath = $newalbum->localpath . internalToFilesystem($newfilename);
 826:         if (file_exists($newpath)) {
 827:             // If the file exists, don't overwrite it.
 828:             if (!(CASE_INSENSITIVE && strtolower($newpath) == strtolower($this->localpath))) {
 829:                 return 2;
 830:             }
 831:         }
 832:         $filename = basename($this->localpath);
 833:         @chmod($filename, 0777);
 834:         $result = @rename($this->localpath, $newpath);
 835:         @chmod($filename, FILE_MOD);
 836:         $this->localpath = $newpath;
 837:         clearstatcache();
 838:         if ($result) {
 839:             $filestomove = safe_glob(substr($this->localpath, 0, strrpos($this->localpath, '.')) . '.*');
 840:             foreach ($filestomove as $file) {
 841:                 if (in_array(strtolower(getSuffix($file)), $this->sidecars)) {
 842:                     $result = $result && @rename($file, stripSuffix($newpath) . '.' . getSuffix($file));
 843:                 }
 844:             }
 845:         }
 846:         if ($result) {
 847:             if (parent::move(array('filename' => $newfilename, 'albumid' => $newalbum->getID()))) {
 848:                 $this->set('mtime', filemtime($newpath));
 849:                 $this->save();
 850:                 return 0;
 851:             }
 852:         }
 853:         return 1;
 854:     }
 855: 
 856:     /**
 857:      * Renames an image to a new filename, keeping it in the same album. Convenience for move($image->album, $newfilename).
 858:      * Returns  true on success and false on failure.
 859:      * @param string $newfilename the new file name of the image file.
 860:      * @return bool
 861:      */
 862:     function rename($newfilename) {
 863:         return $this->move($this->album, $newfilename);
 864:     }
 865: 
 866:     /**
 867:      * Copies the image to a new album, along with all metadata.
 868:      *
 869:      * @param string $newalbum the destination album
 870:      */
 871:     function copy($newalbum) {
 872:         if (is_string($newalbum)) {
 873:             $newalbum = newAlbum($newalbum, false);
 874:         }
 875:         if ($newalbum->getID() == $this->album->getID()) {
 876:             // Nothing to do - moving the file to the same place.
 877:             return 2;
 878:         }
 879:         $newpath = $newalbum->localpath . internalToFilesystem($this->filename);
 880:         if (file_exists($newpath)) {
 881:             // If the file exists, don't overwrite it.
 882:             return 2;
 883:         }
 884:         $filename = basename($this->localpath);
 885:         $result = @copy($this->localpath, $newpath);
 886:         if ($result) {
 887:             $filestocopy = safe_glob(substr($this->localpath, 0, strrpos($this->localpath, '.')) . '.*');
 888:             foreach ($filestocopy as $file) {
 889:                 if (in_array(strtolower(getSuffix($file)), $this->sidecars)) {
 890:                     $result = $result && @copy($file, $newalbum->localpath . basename($file));
 891:                 }
 892:             }
 893:         }
 894:         if ($result) {
 895:             if ($newID = parent::copy(array('filename' => $filename, 'albumid' => $newalbum->getID()))) {
 896:                 storeTags(readTags($this->getID(), 'images'), $newID, 'images');
 897:                 query('UPDATE ' . prefix('images') . ' SET `mtime`=' . filemtime($newpath) . ' WHERE `filename`="' . $filename . '" AND `albumid`=' . $newalbum->getID());
 898:                 return 0;
 899:             }
 900:         }
 901:         return 1;
 902:     }
 903: 
 904:     /*   * ** Image Methods *** */
 905: 
 906:     /**
 907:      * Returns a path urlencoded image page link for the image
 908:      *
 909:      * @return string
 910:      */
 911:     function getLink() {
 912:         if (is_array($this->filename)) {
 913:             $albumq = $album = dirname($this->filename['source']);
 914:             $image = basename($this->filename['source']);
 915:         } else {
 916:             $album = $this->albumlink;
 917:             $albumq = $this->albumnamealbum->name;
 918:             $image = $this->filename;
 919:         }
 920:         return zp_apply_filter('getLink', rewrite_path(pathurlencode($album) . '/' . urlencode($image) . IM_SUFFIX, '/index.php?album=' . pathurlencode($albumq) . '&image=' . urlencode($image)), $this, NULL);
 921:     }
 922: 
 923:     /**
 924:      * Returns a path urlencoded image page link for the image
 925:      * @return string
 926:      * @deprecated since version 1.4.6
 927:      */
 928:     function getImageLink() {
 929:         internal_deprecations::getImageLink();
 930:         return $this->getLink();
 931:     }
 932: 
 933:     /**
 934:      * Returns a path to the original image in the original folder.
 935:      *
 936:      * @param string $path the "path" to the image. Defaults to the simple WEBPATH
 937:      *
 938:      * @return string
 939:      */
 940:     function getFullImage($path = WEBPATH) {
 941:         global $_zp_conf_vars;
 942:         if ($path == WEBPATH && $_zp_conf_vars['album_folder_class'] == 'external') {
 943:             return false;
 944:         }
 945:         if (is_array($this->filename)) {
 946:             $album = dirname($this->filename['source']);
 947:             $image = basename($this->filename['source']);
 948:         } else {
 949:             $album = $this->imagefolder;
 950:             $image = $this->filename;
 951:         }
 952:         return getAlbumFolder($path) . $album . "/" . $image;
 953:     }
 954: 
 955:     /**
 956:      * returns URL to the original image
 957:      */
 958:     function getFullImageURL() {
 959:         return $this->getFullImage(WEBPATH);
 960:     }
 961: 
 962:     /**
 963:      * Returns a path to a sized version of the image
 964:      *
 965:      * @param int $size how big an image is wanted
 966:      * @return string
 967:      */
 968:     function getSizedImage($size) {
 969:         $wmt = getWatermarkParam($this, WATERMARK_IMAGE);
 970:         $args = getImageParameters(array($size, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $wmt), $this->album->name);
 971:         return getImageURI($args, $this->album->name, $this->filename, $this->filemtime);
 972:     }
 973: 
 974:     /**
 975:      *  Get a custom sized version of this image based on the parameters.
 976:      *
 977:      * @param int $size size
 978:      * @param int $width width
 979:      * @param int $height height
 980:      * @param int $cropw crop width
 981:      * @param int $croph crop height
 982:      * @param int $cropx crop x axis
 983:      * @param int $cropy crop y axis
 984:      * @param bool $thumbStandin set to true to treat as thumbnail
 985:      * @param bool $effects set to desired image effect (e.g. 'gray' to force gray scale)
 986:      * @return string
 987:      */
 988:     function getCustomImage($size, $width, $height, $cropw, $croph, $cropx, $cropy, $thumbStandin = false, $effects = NULL) {
 989:         if ($thumbStandin < 0) {
 990:             $wmt = '!';
 991:         } else {
 992:             if ($thumbStandin) {
 993:                 $wmt = getWatermarkParam($this, WATERMARK_THUMB);
 994:             } else {
 995:                 $wmt = getWatermarkParam($this, WATERMARK_IMAGE);
 996:             }
 997:         }
 998:         $args = getImageParameters(array($size, $width, $height, $cropw, $croph, $cropx, $cropy, NULL, $thumbStandin, NULL, $thumbStandin, $wmt, NULL, $effects), $this->album->name);
 999:         return getImageURI($args, $this->album->name, $this->filename, $this->filemtime);
1000:     }
1001: 
1002:     /**
1003:      * Returns the default sized image HTML
1004:      *
1005:      * @return string
1006:      */
1007:     function getContent() {
1008:         $class = '';
1009:         if (!$this->getShow()) {
1010:             $class .= " not_visible";
1011:         }
1012:         $album = $this->getAlbum();
1013:         $pwd = $album->getPassword();
1014:         if (!empty($pwd)) {
1015:             $class .= " password_protected";
1016:         }
1017:         $size = getOption('image_size');
1018:         $h = $this->getHeight();
1019:         $w = $this->getWidth();
1020:         $side = getOption('image_use_side');
1021:         $us = getOption('image_allow_upscale');
1022:         $dim = $size;
1023: 
1024:         if ($w == 0) {
1025:             $hprop = 1;
1026:         } else {
1027:             $hprop = round(($h / $w) * $dim);
1028:         }
1029:         if ($h == 0) {
1030:             $wprop = 1;
1031:         } else {
1032:             $wprop = round(($w / $h) * $dim);
1033:         }
1034: 
1035:         if (($size && ($side == 'longest' && $h > $w) || ($side == 'height') || ($side == 'shortest' && $h < $w))) {
1036: // Scale the height
1037:             $newh = $dim;
1038:             $neww = $wprop;
1039:         } else {
1040: // Scale the width
1041:             $neww = $dim;
1042:             $newh = $hprop;
1043:         }
1044:         if (!$us && $newh >= $h && $neww >= $w) {
1045:             $neww = $w;
1046:             $newh = $h;
1047:         }
1048:         $html = '<img src="' . html_encode(pathurlencode($this->getSizedImage($size))) . '" alt="' . html_encode($this->getTitle()) . '"' .
1049:                         ' width="' . $neww . '" height="' . $newh . '"' .
1050:                         (($class) ? " class=\"$class\"" : "") . " />";
1051:         $html = zp_apply_filter('standard_image_html', $html);
1052:         return $html;
1053:     }
1054: 
1055:     /**
1056:      * Returns the image file name for the thumbnail image.
1057:      *
1058:      * @param string $path override path
1059:      *
1060:      * @return s
1061:      */
1062:     function getThumbImageFile() {
1063:         return $local = $this->localpath;
1064:     }
1065: 
1066:     /**
1067:      * Returns an array of cropping parameters. Used as a "helper" function for various
1068:      * inherited getThumb() methods
1069:      *
1070:      * @param string $type the type of thumb (in case it ever matters in the cropping, now it does not.)
1071:      */
1072:     function getThumbCropping($ts, $sw, $sh) {
1073:         $cy = $this->get('thumbY');
1074:         if (is_null($cy)) {
1075:             $custom = $cx = $cw = $ch = NULL;
1076:         } else {
1077:             $custom = true;
1078:             $cx = $this->get('thumbX');
1079:             $cw = $this->get('thumbW');
1080:             $ch = $this->get('thumbH');
1081:             // upscale to thumb_size proportions
1082:             if ($sw == $sh) { // square crop, set the size/width to thumbsize
1083:                 $sw = $sh = $ts;
1084:             } else {
1085:                 if ($sw > $sh) {
1086:                     $r = $ts / $sw;
1087:                     $sw = $ts;
1088:                     $sh = $sh * $r;
1089:                 } else {
1090:                     $r = $ts / $sh;
1091:                     $sh = $ts;
1092:                     $sh = $r * $sh;
1093:                 }
1094:             }
1095:         }
1096:         return array($custom, $cw, $ch, $cx, $cy);
1097:     }
1098: 
1099:     /**
1100:      * Get a default-sized thumbnail of this image.
1101:      *
1102:      * @return string
1103:      */
1104:     function getThumb($type = 'image') {
1105:         $ts = getOption('thumb_size');
1106:         if (getOption('thumb_crop')) {
1107:             $sw = getOption('thumb_crop_width');
1108:             $sh = getOption('thumb_crop_height');
1109:             list($custom, $cw, $ch, $cx, $cy) = $this->getThumbCropping($ts, $sw, $sh);
1110:             if ($custom) {
1111:                 return $this->getCustomImage(NULL, $sw, $sh, $cw, $ch, $cx, $cy, true);
1112:             }
1113:         } else {
1114:             $sw = $sh = NULL;
1115:         }
1116:         $wmt = getWatermarkParam($this, WATERMARK_THUMB);
1117:         $args = getImageParameters(array($ts, NULL, NULL, $sw, $sh, NULL, NULL, NULL, true, NULL, true, $wmt, NULL, NULL), $this->album->name);
1118: 
1119:         return getImageURI($args, $this->album->name, $this->filename, $this->filemtime);
1120:     }
1121: 
1122:     /**
1123:      * Get the index of this image in the album, taking sorting into account.
1124:      *
1125:      * @return int
1126:      */
1127:     function getIndex() {
1128:         global $_zp_current_search, $_zp_current_album;
1129:         if ($this->index == NULL) {
1130:             $album = $this->albumnamealbum;
1131:             if (!is_null($_zp_current_search) && !in_context(ZP_ALBUM_LINKED) || $album->isDynamic()) {
1132:                 if ($album->isDynamic()) {
1133:                     $images = $album->getImages();
1134:                     for ($i = 0; $i < count($images); $i++) {
1135:                         $image = $images[$i];
1136:                         if ($this->filename == $image['filename']) {
1137:                             $this->index = $i;
1138:                             break;
1139:                         }
1140:                     }
1141:                 } else {
1142:                     $this->index = $_zp_current_search->getImageIndex($this->imagefolder, $this->filename);
1143:                 }
1144:             } else {
1145:                 $images = $this->album->getImages(0);
1146:                 for ($i = 0; $i < count($images); $i++) {
1147:                     $image = $images[$i];
1148:                     if ($this->filename == $image) {
1149:                         $this->index = $i;
1150:                         break;
1151:                     }
1152:                 }
1153:             }
1154:         }
1155:         return $this->index;
1156:     }
1157: 
1158:     /**
1159:      * Returns the next Image.
1160:      *
1161:      * @return object
1162:      */
1163:     function getNextImage() {
1164:         global $_zp_current_search;
1165:         $index = $this->getIndex();
1166:         if (!is_null($_zp_current_search) && !in_context(ZP_ALBUM_LINKED)) {
1167:             $image = $_zp_current_search->getImage($index + 1);
1168:         } else {
1169:             $album = $this->albumnamealbum;
1170:             $image = $album->getImage($index + 1);
1171:         }
1172:         return $image;
1173:     }
1174: 
1175:     /**
1176:      * Return the previous Image
1177:      *
1178:      * @return object
1179:      */
1180:     function getPrevImage() {
1181:         global $_zp_current_search;
1182:         $index = $this->getIndex();
1183:         if (!is_null($_zp_current_search) && !in_context(ZP_ALBUM_LINKED)) {
1184:             $image = $_zp_current_search->getImage($index - 1);
1185:         } else {
1186:             $album = $this->albumnamealbum;
1187:             $image = $album->getImage($index - 1);
1188:         }
1189:         return $image;
1190:     }
1191: 
1192:     /**
1193:      * Returns the disk size of the image
1194:      *
1195:      * @return string
1196:      */
1197:     function getImageFootprint() {
1198:         return filesize($this->localpath);
1199:     }
1200: 
1201:     /**
1202:      * Returns the custom watermark name
1203:      *
1204:      * @return string
1205:      */
1206:     function getWatermark() {
1207:         return $this->get('watermark');
1208:     }
1209: 
1210:     /**
1211:      * Set custom watermark
1212:      *
1213:      * @param string $wm
1214:      */
1215:     function setWatermark($wm) {
1216:         $this->set('watermark', $wm);
1217:     }
1218: 
1219:     /**
1220:      * Returns the custom watermark usage
1221:      *
1222:      * @return bool
1223:      */
1224:     function getWMUse() {
1225:         return $this->get('watermark_use');
1226:     }
1227: 
1228:     /**
1229:      * Sets the custom watermark usage
1230:      *
1231:      * @param $use
1232:      */
1233:     function setWMUse($use) {
1234:         $this->set('watermark_use', $use);
1235:     }
1236: 
1237:     /**
1238:      * Owner functions
1239:      */
1240:     function getOwner() {
1241:         $owner = $this->get('owner');
1242:         if (empty($owner)) {
1243:             $owner = $this->album->getOwner();
1244:         }
1245:         return $owner;
1246:     }
1247: 
1248:     function setOwner($owner) {
1249:         $this->set('owner', $owner);
1250:     }
1251: 
1252:     function isMyItem($action) {
1253:         $album = $this->album;
1254:         return $album->isMyItem($action);
1255:     }
1256: 
1257:     /**
1258:      * returns true if user is allowed to see the image
1259:      */
1260:     function checkAccess(&$hint = NULL, &$show = NULL) {
1261:         $album = $this->getAlbum();
1262:         if ($album->isMyItem(LIST_RIGHTS)) {
1263:             return $this->getShow() || $album->albumSubRights() & (MANAGED_OBJECT_RIGHTS_EDIT | MANAGED_OBJECT_RIGHTS_VIEW);
1264:         }
1265:         return $album->checkforGuest($hint, $show) && $this->getShow() && $album->getShow();
1266:     }
1267: 
1268:     /**
1269:      * Checks if guest is loggedin for the album
1270:      * @param unknown_type $hint
1271:      * @param unknown_type $show
1272:      */
1273:     function checkforGuest(&$hint = NULL, &$show = NULL) {
1274:         if (!parent::checkForGuest()) {
1275:             return false;
1276:         }
1277:         $album = $this->getAlbum();
1278:         return $album->checkforGuest($hint, $show);
1279:     }
1280: 
1281:     /**
1282:      *
1283:      * returns true if there is any protection on the image
1284:      */
1285:     function isProtected() {
1286:         return $this->checkforGuest() != 'zp_public_access';
1287:     }
1288: 
1289: }
1290: 
1291: class Transientimage extends Image {
1292: 
1293:     /**
1294:      * creates a transient image (that is, one that is not stored in the database)
1295:      *
1296:      * @param string $image the full path to the image
1297:      * @return transientimage
1298:      */
1299:     function __construct($album, $image) {
1300:         if (!is_object($album)) {
1301:             $album = new AlbumBase('Transient');
1302:         }
1303:         $this->album = $album;
1304:         $this->localpath = $image;
1305:         $filename = makeSpecialImageName($image);
1306:         $this->filename = $filename;
1307:         $this->displayname = stripSuffix(basename($image));
1308:         if (empty($this->displayname)) {
1309:             $this->displayname = $this->filename['name'];
1310:         }
1311:         $this->filemtime = @filemtime($this->localpath);
1312:         $this->comments = null;
1313:         $this->instantiate('images', array('filename' => $filename['name'], 'albumid' => $this->album->getID()), 'filename', true, true);
1314:         $this->exists = false;
1315:     }
1316: 
1317: }
1318: 
1319: ?>
1320: 
Zenphoto doc API documentation generated by ApiGen