Overview

Namespaces

  • Composer
    • Autoload
  • Geekwright
    • RegDom
  • League
    • OAuth2
      • Client
        • Provider
  • None
  • Xmf
    • Database
    • Jwt
    • Key
    • Module
      • Helper

Classes

  • ArtObject
  • ArtObjectHandler
  • BloggerApi
  • CGIF
  • CGIFCOLORTABLE
  • CGIFFILEHEADER
  • CGIFIMAGE
  • CGIFIMAGEHEADER
  • CGIFLZW
  • Composer\Autoload\ClassLoader
  • Composer\Autoload\ComposerStaticInit274e5fff219a4f27a346e611b0580d6a
  • ComposerAutoloaderInit274e5fff219a4f27a346e611b0580d6a
  • Config_File
  • Cookie
  • Criteria
  • CriteriaCompo
  • CriteriaElement
  • Database
  • Db_manager
  • ErrorHandler
  • FormDhtmlTextArea
  • FormTextArea
  • Geekwright\RegDom\PublicSuffixList
  • Geekwright\RegDom\RegisteredDomain
  • HTMLPurifier
  • League\OAuth2\Client\Provider\Google
  • MetaWeblogApi
  • ModuleAdmin
  • MovableTypeApi
  • MyTextSanitizer
  • MyTextSanitizerExtended
  • MyTextSanitizerExtension
  • MytsCensor
  • MytsFlash
  • MytsIframe
  • MytsImage
  • MytsLi
  • MytsMms
  • MytsMp3
  • MytsRtsp
  • MytsSoundcloud
  • MytsSyntaxhighlight
  • MytsTextfilter
  • MytsUl
  • MytsWiki
  • MytsWmp
  • MytsYoutube
  • PathStuffController
  • PHPMailer
  • PHPMailerOAuth
  • PHPMailerOAuthGoogle
  • phpthumb
  • phpthumb_bmp
  • phpthumb_filters
  • phpthumb_functions
  • phpthumb_ico
  • phpUnsharpMask
  • PmCorePreload
  • PmMessage
  • PmMessageHandler
  • PmSystemPreload
  • POP3
  • ProfileCategory
  • ProfileCategoryHandler
  • ProfileCorePreload
  • ProfileField
  • ProfileFieldHandler
  • ProfileProfile
  • ProfileProfileHandler
  • ProfileRegstep
  • ProfileRegstepHandler
  • ProfileVisibility
  • ProfileVisibilityHandler
  • Protector
  • Protector_bruteforce_overrun_message
  • Protector_crawler_overrun_message
  • Protector_f5attack_overrun_message
  • Protector_postcommon_post_deny_by_httpbl
  • Protector_postcommon_post_deny_by_rbl
  • Protector_postcommon_post_htmlpurify4everyone
  • Protector_postcommon_post_htmlpurify4guest
  • Protector_postcommon_post_language_match
  • Protector_postcommon_post_need_multibyte
  • Protector_postcommon_post_register_moratorium
  • Protector_postcommon_post_stopforumspam
  • Protector_postcommon_register_insert_js_check
  • Protector_postcommon_register_stopforumspam
  • Protector_precommon_badip_errorlog
  • Protector_precommon_badip_message
  • Protector_precommon_badip_redirection
  • Protector_precommon_bwlimit_errorlog
  • Protector_precommon_bwlimit_message
  • Protector_prepurge_exit_message
  • Protector_spamcheck_overrun_message
  • ProtectorCorePreload
  • ProtectorFilterAbstract
  • ProtectorFilterHandler
  • ProtectorMySQLDatabase
  • ProtectorRegistry
  • ReCaptchaResponse
  • RpcArrayHandler
  • RpcBase64Handler
  • RpcBooleanHandler
  • RpcDateTimeHandler
  • RpcDoubleHandler
  • RpcIntHandler
  • RpcMemberHandler
  • RpcMethodNameHandler
  • RpcNameHandler
  • RpcStringHandler
  • RpcStructHandler
  • RpcValueHandler
  • RssAuthorHandler
  • RssCategoryHandler
  • RssChannelHandler
  • RssCommentsHandler
  • RssCopyrightHandler
  • RssDescriptionHandler
  • RssDocsHandler
  • RssGeneratorHandler
  • RssGuidHandler
  • RssHeightHandler
  • RssImageHandler
  • RssItemHandler
  • RssLanguageHandler
  • RssLastBuildDateHandler
  • RssLinkHandler
  • RssManagingEditorHandler
  • RssNameHandler
  • RssPubDateHandler
  • RssSourceHandler
  • RssTextInputHandler
  • RssTitleHandler
  • RssTtlHandler
  • RssUrlHandler
  • RssWebMasterHandler
  • RssWidthHandler
  • SaxParser
  • Smarty
  • Smarty_Compiler
  • SMTP
  • Snoopy
  • SqlUtility
  • SystemAvatar
  • SystemAvatarHandler
  • SystemBanner
  • SystemBannerclient
  • SystemBannerclientHandler
  • SystemBannerFinish
  • SystemBannerfinishHandler
  • SystemBannerHandler
  • SystemBlock
  • SystemBlockHandler
  • SystemBlockLinkModule
  • SystemBlockLinkModuleHandler
  • SystemBreadcrumb
  • SystemCorePreload
  • SystemFineAvatarUploadHandler
  • SystemFineImUploadHandler
  • SystemFineUploadHandler
  • SystemGroup
  • SystemGroupHandler
  • SystemMaintenance
  • SystemMenuHandler
  • SystemSmilies
  • SystemsmiliesHandler
  • SystemUserrank
  • SystemuserrankHandler
  • SystemUsers
  • SystemUsersHandler
  • Tar
  • ThemeSetAuthorHandler
  • ThemeSetDateCreatedHandler
  • ThemeSetDescriptionHandler
  • ThemeSetEmailHandler
  • ThemeSetFileTypeHandler
  • ThemeSetGeneratorHandler
  • ThemeSetImageHandler
  • ThemeSetLinkHandler
  • ThemeSetModuleHandler
  • ThemeSetNameHandler
  • ThemeSetTagHandler
  • ThemeSetTemplateHandler
  • TinyMCE
  • Xmf\Assert
  • Xmf\Database\Migrate
  • Xmf\Database\TableLoad
  • Xmf\Database\Tables
  • Xmf\Debug
  • Xmf\FilterInput
  • Xmf\Highlighter
  • Xmf\IPAddress
  • Xmf\Jwt\JsonWebToken
  • Xmf\Jwt\KeyFactory
  • Xmf\Jwt\TokenFactory
  • Xmf\Jwt\TokenReader
  • Xmf\Key\ArrayStorage
  • Xmf\Key\Basic
  • Xmf\Key\FileStorage
  • Xmf\Key\KeyAbstract
  • Xmf\Language
  • Xmf\Metagen
  • Xmf\Module\Admin
  • Xmf\Module\Helper
  • Xmf\Module\Helper\AbstractHelper
  • Xmf\Module\Helper\Cache
  • Xmf\Module\Helper\GenericHelper
  • Xmf\Module\Helper\Permission
  • Xmf\Module\Helper\Session
  • Xmf\Random
  • Xmf\Request
  • Xmf\StopWords
  • Xmf\Yaml
  • XmlTagHandler
  • XoopsApi
  • xoopsart
  • XoopsAuth
  • XoopsAuthAds
  • XoopsAuthFactory
  • XoopsAuthLdap
  • XoopsAuthProvisionning
  • XoopsAuthXoops
  • XoopsAvatar
  • XoopsAvatarHandler
  • XoopsBlock
  • XoopsBlockHandler
  • XoopsBlockInstance
  • XoopsBlockInstanceHandler
  • XoopsCache
  • XoopsCacheApc
  • XoopsCacheEngine
  • XoopsCacheFile
  • XoopsCacheMemcache
  • XoopsCacheModel
  • XoopsCacheModelHandler
  • XoopsCacheModelObject
  • XoopsCacheXcache
  • XoopsCaptcha
  • XoopsCaptchaImage
  • XoopsCaptchaImageHandler
  • XoopsCaptchaMethod
  • XoopsCaptchaRecaptcha
  • XoopsCaptchaRecaptcha2
  • XoopsCaptchaText
  • XoopsComment
  • XoopsCommentHandler
  • XoopsCommentRenderer
  • XoopsComments
  • XoopsConfigCategory
  • XoopsConfigCategoryHandler
  • XoopsConfigHandler
  • XoopsConfigItem
  • XoopsConfigItemHandler
  • XoopsConfigOption
  • XoopsConfigOptionHandler
  • XoopsDatabase
  • XoopsDatabaseFactory
  • XoopsDownloader
  • XoopsEditor
  • XoopsEditorHandler
  • XoopsErrorHandler
  • XoopsFile
  • XoopsFileHandler
  • XoopsFilterInput
  • XoopsFolderHandler
  • XoopsForm
  • XoopsFormButton
  • XoopsFormButtonTray
  • XoopsFormCaptcha
  • XoopsFormCheckBox
  • XoopsFormColorPicker
  • XoopsFormDateTime
  • XoopsFormDhtmlTextArea
  • XoopsFormEditor
  • XoopsFormElement
  • XoopsFormElementTray
  • XoopsFormFile
  • XoopsFormHidden
  • XoopsFormHiddenToken
  • XoopsFormLabel
  • XoopsFormPassword
  • XoopsFormRadio
  • XoopsFormRadioYN
  • XoopsFormRenderer
  • XoopsFormRendererBootstrap3
  • XoopsFormRendererLegacy
  • XoopsFormSelect
  • XoopsFormSelectCheckGroup
  • XoopsFormSelectCountry
  • XoopsFormSelectEditor
  • XoopsFormSelectGroup
  • XoopsFormSelectLang
  • XoopsFormSelectMatchOption
  • XoopsFormSelectTheme
  • XoopsFormSelectTimezone
  • XoopsFormSelectUser
  • XoopsFormText
  • XoopsFormTextArea
  • XoopsFormTextDateSelect
  • XoopsFormTinymce
  • XoopsGroup
  • XoopsGroupFormCheckBox
  • XoopsGroupHandler
  • XoopsGroupPerm
  • XoopsGroupPermForm
  • XoopsGroupPermHandler
  • XoopsGTicket
  • XoopsGuestUser
  • XoopsGuiDefault
  • XoopsGuiThadmin
  • XoopsGuiTransition
  • XoopsGuiZetadigme
  • XoopsHandlerRegistry
  • XoopsImage
  • XoopsImagecategory
  • XoopsImagecategoryHandler
  • XoopsImageHandler
  • XoopsImageSet
  • XoopsImagesetHandler
  • XoopsImagesetimg
  • XoopsImagesetimgHandler
  • XoopsInstallWizard
  • XoopsLists
  • XoopsLoad
  • XoopsLocal
  • XoopsLocalAbstract
  • XoopsLocalWrapper
  • XoopsLogger
  • XoopsMailer
  • XoopsMailerLocal
  • XoopsMediaUploader
  • XoopsMemberHandler
  • XoopsMembership
  • XoopsMembershipHandler
  • XoopsModelAbstract
  • XoopsModelFactory
  • XoopsModelJoint
  • XoopsModelRead
  • XoopsModelStats
  • XoopsModelSync
  • XoopsModelWrite
  • XoopsModule
  • XoopsModuleHandler
  • XoopsMultiMailer
  • XoopsMySQLDatabase
  • XoopsMySQLDatabaseProxy
  • XoopsMySQLDatabaseSafe
  • XoopsNotification
  • XoopsNotificationHandler
  • XoopsObject
  • XoopsObjectHandler
  • XoopsObjectTree
  • XoopsOnlineHandler
  • XoopsPageNav
  • XoopsPersistableObjectHandler
  • XoopsPreload
  • XoopsPreloadItem
  • XoopsPrivmessage
  • XoopsPrivmessageHandler
  • XoopsRank
  • XoopsRankHandler
  • XoopsRequest
  • XoopsSecurity
  • XoopsSessionHandler
  • XoopsSimpleForm
  • XoopsStory
  • XoopsSystemCpanel
  • XoopsSystemGui
  • XoopsTableForm
  • XoopsTarDownloader
  • XoopsThemeForm
  • XoopsThemeSetParser
  • XoopsTopic
  • XoopsTpl
  • XoopsTplfile
  • XoopsTplfileHandler
  • XoopsTplset
  • XoopsTplsetHandler
  • XoopsTree
  • XoopsUser
  • XoopsUserHandler
  • XoopsUserUtility
  • XoopsUtility
  • XoopsXmlRpcApi
  • XoopsXmlRpcArray
  • XoopsXmlRpcBase64
  • XoopsXmlRpcBoolean
  • XoopsXmlRpcDatetime
  • XoopsXmlRpcDocument
  • XoopsXmlRpcDouble
  • XoopsXmlRpcFault
  • XoopsXmlRpcInt
  • XoopsXmlRpcParser
  • XoopsXmlRpcRequest
  • XoopsXmlRpcResponse
  • XoopsXmlRpcString
  • XoopsXmlRpcStruct
  • XoopsXmlRpcTag
  • XoopsXmlRss2Parser
  • XoopsZipDownloader
  • xos_kernel_Xoops2
  • xos_logos_PageBuilder
  • xos_opal_AdminThemeFactory
  • xos_opal_Theme
  • xos_opal_ThemeFactory
  • XoUser
  • XoUserHandler
  • Zipfile

Interfaces

  • Xmf\Key\StorageInterface
  • XoopsFormRendererInterface

Exceptions

  • phpmailerException

Functions

  • __autoload
  • _recaptcha_aes_encrypt
  • _recaptcha_aes_pad
  • _recaptcha_http_post
  • _recaptcha_mailhide_email_parts
  • _recaptcha_mailhide_urlbase64
  • _recaptcha_qsencode
  • _smarty_regex_replace_check
  • _smarty_sort_length
  • admin_refcheck
  • b_system_comments_edit
  • b_system_comments_show
  • b_system_info_edit
  • b_system_info_show
  • b_system_login_show
  • b_system_main_show
  • b_system_newmembers_edit
  • b_system_newmembers_show
  • b_system_notification_show
  • b_system_online_show
  • b_system_search_show
  • b_system_themes_edit
  • b_system_themes_show
  • b_system_topposters_edit
  • b_system_topposters_show
  • b_system_user_show
  • b_system_waiting_show
  • bannerstats
  • change_banner_url_by_client
  • checkEmail
  • clickbanner
  • clientlogin
  • closeTable
  • closeThread
  • CloseWaitBox
  • Composer\Autoload\includeFile
  • composerRequire274e5fff219a4f27a346e611b0580d6a
  • createConfigform
  • createThemeform
  • doConditionalGet
  • emailStats
  • exit404BadReq
  • fatalPhpErrorHandler
  • file_get_contents
  • file_put_contents
  • findSharp
  • form_user
  • formatTimestamp
  • formatURL
  • gd_info
  • genPathCheckHtml
  • get_request_method
  • get_writeoks_from_protector
  • getcss
  • getDbCharsets
  • getDbCollations
  • getDirList
  • getMailer
  • getTheme
  • gif_getSize
  • gif_loadFile
  • gif_loadFileToGDimageResource
  • gif_outputAsBmp
  • gif_outputAsJpeg
  • gif_outputAsPng
  • HTMLPurifier
  • imagealphablending
  • imageBrowser
  • imageCreateCorners
  • imageFilenameCheck
  • imagesavealpha
  • install_acceptUser
  • install_finalize
  • is_executable
  • kses
  • langDropdown
  • load_functions
  • load_object
  • load_objectHandler
  • loadModuleAdminMenu
  • make_cblock
  • make_data
  • make_groups
  • make_sidebar
  • mod_clearCacheFile
  • mod_clearConfg
  • mod_clearConfig
  • mod_clearFile
  • mod_clearSmartyCache
  • mod_constant
  • mod_createCacheFile
  • mod_createCacheFile_byGroup
  • mod_createFile
  • mod_DB_prefix
  • mod_fetchConfg
  • mod_fetchConfig
  • mod_generateCacheId
  • mod_generateCacheId_byGroup
  • mod_getDirname
  • mod_getIP
  • mod_getMysqlVersion
  • mod_getUnameFromId
  • mod_getUnameFromIds
  • mod_isModuleAction
  • mod_loadCacheFile
  • mod_loadCacheFile_byGroup
  • mod_loadConfg
  • mod_loadConfig
  • mod_loadFile
  • mod_loadFunctions
  • mod_loadRenderer
  • mod_message
  • modify_chmod
  • myTextForm
  • notificationCategoryInfo
  • notificationCommentCategoryInfo
  • notificationEnabled
  • notificationEventEnabled
  • notificationEventInfo
  • notificationEvents
  • notificationGenerateConfig
  • notificationSubscribableCategoryInfo
  • openTable
  • openThread
  • OpenWaitBox
  • PHPMailerAutoload
  • phpThumbURL
  • preg_quote
  • profile_getFieldForm
  • profile_getRegisterForm
  • profile_getStepForm
  • profile_getUserForm
  • profile_install_addCategory
  • profile_install_addField
  • profile_install_addStep
  • profile_install_initializeProfiles
  • profile_install_setPermissions
  • protector_message_append_oninstall
  • protector_message_append_onuninstall
  • protector_message_append_onupdate
  • protector_notify_base
  • protector_oninstall_base
  • protector_onuninstall_base
  • protector_onupdate_base
  • protector_postcommon
  • protector_prepare
  • recaptcha_check_answer
  • recaptcha_get_html
  • recaptcha_get_signup_url
  • recaptcha_mailhide_html
  • recaptcha_mailhide_url
  • redirect_header
  • RedirectToCachedFile
  • SendSaveAsFileHeaderIfNeeded
  • showbanner
  • showThread
  • smarty_block_textformat
  • smarty_compiler_assign
  • smarty_compiler_foreachq
  • smarty_compiler_includeq
  • smarty_compiler_xoAdminIcons
  • smarty_compiler_xoAdminNav
  • smarty_compiler_xoAppUrl
  • smarty_compiler_xoImgUrl
  • smarty_compiler_xoModuleIcons16
  • smarty_compiler_xoModuleIcons32
  • smarty_compiler_xoModuleIconsBookmarks
  • smarty_core_assemble_plugin_filepath
  • smarty_core_assign_smarty_interface
  • smarty_core_create_dir_structure
  • smarty_core_display_debug_console
  • smarty_core_get_include_path
  • smarty_core_get_microtime
  • smarty_core_get_php_resource
  • smarty_core_is_secure
  • smarty_core_is_trusted
  • smarty_core_load_plugins
  • smarty_core_load_resource_plugin
  • smarty_core_process_cached_inserts
  • smarty_core_process_compiled_include
  • smarty_core_read_cache_file
  • smarty_core_rm_auto
  • smarty_core_rmdir
  • smarty_core_run_insert_handler
  • smarty_core_smarty_include_php
  • smarty_core_write_cache_file
  • smarty_core_write_compiled_include
  • smarty_core_write_compiled_resource
  • smarty_core_write_file
  • smarty_function_assign_debug_info
  • smarty_function_block
  • smarty_function_config_load
  • smarty_function_counter
  • smarty_function_cycle
  • smarty_function_debug
  • smarty_function_escape_special_chars
  • smarty_function_eval
  • smarty_function_fetch
  • smarty_function_html_checkboxes
  • smarty_function_html_checkboxes_output
  • smarty_function_html_image
  • smarty_function_html_options
  • smarty_function_html_options_optgroup
  • smarty_function_html_options_optoutput
  • smarty_function_html_radios
  • smarty_function_html_radios_output
  • smarty_function_html_select_date
  • smarty_function_html_select_time
  • smarty_function_html_table
  • smarty_function_html_table_cycle
  • smarty_function_mailto
  • smarty_function_math
  • smarty_function_popup
  • smarty_function_popup_init
  • smarty_function_securityToken
  • smarty_function_xoInboxCount
  • smarty_function_xoMemberInfo
  • smarty_function_xoops_link
  • smarty_function_xoPageNav
  • smarty_make_timestamp
  • smarty_modifier_capitalize
  • smarty_modifier_capitalize_ucfirst
  • smarty_modifier_cat
  • smarty_modifier_count_characters
  • smarty_modifier_count_paragraphs
  • smarty_modifier_count_sentences
  • smarty_modifier_count_words
  • smarty_modifier_date_format
  • smarty_modifier_debug_print_var
  • smarty_modifier_default
  • smarty_modifier_escape
  • smarty_modifier_indent
  • smarty_modifier_lower
  • smarty_modifier_nl2br
  • smarty_modifier_regex_replace
  • smarty_modifier_replace
  • smarty_modifier_spacify
  • smarty_modifier_string_format
  • smarty_modifier_strip
  • smarty_modifier_strip_tags
  • smarty_modifier_truncate
  • smarty_modifier_upper
  • smarty_modifier_wordwrap
  • smarty_outputfilter_trimwhitespace
  • smarty_outputfilter_trimwhitespace_replace
  • smarty_resource_db_secure
  • smarty_resource_db_source
  • smarty_resource_db_timestamp
  • smarty_resource_db_tplinfo
  • smarty_resource_db_trusted
  • synchronize
  • system_AdminIcons
  • system_adminVersion
  • system_CleanVars
  • system_loadLanguage
  • system_loadTemplate
  • themecenterposts
  • update_system_v211
  • userCheck
  • userTimeToServerTime
  • validateDbCharset
  • writeLicenseKey
  • xoBuildLicenceKey
  • xoDiag
  • xoDiagBoolSetting
  • xoDiagIfWritable
  • xoFormBlockCollation
  • xoFormField
  • xoFormFieldCharset
  • xoFormFieldCollation
  • xoFormSelect
  • xoops_aw_decode
  • xoops_aw_encode
  • xoops_bin2hex
  • xoops_comment_count
  • xoops_comment_delete
  • xoops_confirm
  • xoops_convert_decode
  • xoops_convert_encode
  • xoops_convert_encoding
  • xoops_cp_footer
  • xoops_cp_header
  • xoops_error
  • xoops_footer
  • xoops_getActiveModules
  • xoops_getbanner
  • xoops_getBaseDomain
  • xoops_getConfigOption
  • xoops_getcss
  • xoops_getenv
  • xoops_getHandler
  • xoops_getLinkedUnameFromId
  • xoops_getMailer
  • xoops_getModuleHandler
  • xoops_getModuleOption
  • xoops_getOption
  • xoops_getrank
  • xoops_getUrlDomain
  • xoops_getUserTimestamp
  • xoops_groupperm_deletebymoditem
  • xoops_header
  • xoops_hex2bin
  • xoops_isActiveModule
  • xoops_ishexstr
  • xoops_load
  • xoops_load_lang_file
  • xoops_loadLanguage
  • xoops_local
  • xoops_makepass
  • xoops_message
  • xoops_module_activate
  • xoops_module_change
  • xoops_module_deactivate
  • xoops_module_delayed_clean_cache
  • xoops_module_get_admin_menu
  • xoops_module_gettemplate
  • xoops_module_install
  • xoops_module_install_pm
  • xoops_module_install_profile
  • xoops_module_log_header
  • xoops_module_uninstall
  • xoops_module_update
  • xoops_module_update_pm
  • xoops_module_update_profile
  • xoops_module_update_system
  • xoops_module_write_admin_menu
  • xoops_notification_deletebyitem
  • xoops_notification_deletebymodule
  • xoops_notification_deletebyuser
  • xoops_refcheck
  • xoops_result
  • xoops_setActiveModules
  • xoops_setConfigOption
  • xoops_substr
  • xoops_template_clear_module_cache
  • xoops_template_touch
  • xoops_trim
  • xoops_utf8_encode
  • xoops_write_index_file
  • xoopsCodeTarea
  • xoopseditor_get_rootpath
  • XoopsErrorHandler_HandleError
  • xoopsfwrite
  • xoopsSmilies
  • xoPassField
  • xoPhpVersion
  • xoPutLicenseKey
  • xoStripeKey
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * XOOPS image access/edit
  4:  *
  5:  * You may not change or alter any portion of this comment or credits
  6:  * of supporting developers from this source code or any supporting source code
  7:  * which is considered copyrighted (c) material of the original comment or credit authors.
  8:  * This program is distributed in the hope that it will be useful,
  9:  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 10:  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 11:  *
 12:  * @copyright       (c) 2000-2016 XOOPS Project (www.xoops.org)
 13:  * @license             GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html)
 14:  * @package             core
 15:  * @since               2.5.7
 16:  * @author              luciorota <lucio.rota@gmail.com>, Joe Lencioni <joe@shiftingpixel.com>
 17:  *
 18:  * Enhanced image access/edit
 19:  * This enhanced version is very useful in many cases, for example when you need a
 20:  * smallest version of an image. This script uses Xoops cache to minimize server load.
 21:  *
 22:  *
 23:  * Parameters need to be passed in through the URL's query string:
 24:  * @param int      id             Xoops image id;
 25:  * @param string   url            relative to XOOPS_ROOT_PATH, path of local image starting with "/"
 26:  *                                 (e.g. /images/toast.jpg);
 27:  * @param string   src            relative to XOOPS_ROOT_PATH, path of local image starting with "/"
 28:  * @param int      width          (optional) maximum width of final image in pixels (e.g. 700);
 29:  * @param int      height         (optional) maximum height of final image in pixels (e.g. 700);
 30:  * @param string   color          (optional) background hex color for filling transparent PNGs (e.g. 900 or 16a942);
 31:  * @param string   cropratio      (optional) ratio of width to height to crop final image (e.g. 1:1 or 3:2);
 32:  * @param boolean  nocache        (optional) don't read image from the cache;
 33:  * @param boolean  noservercache  (optional) don't read image from the server cache;
 34:  * @param boolean  nobrowsercache (optional) don't read image from the browser cache;
 35:  * @param int      quality        (optional, 0-100, default: 90) quality of output image;
 36:  * @param mixed    filter         (optional, imagefilter 2nd, 3rd, 4th, 5th arguments, more info on php.net
 37:  *                                 manual) a filter or an array of filters;
 38:  * @param int      radius         (optional, 1, 2, 3 or 4 integer values, CW) round corner radius
 39:  * @param float    angle          (optional), rotation angle)
 40:  *
 41:  */
 42: 
 43: /* @example         image.php
 44:  * Resizing a JPEG:
 45:  * <img src="/image.php?url=image-name.jpg&width=100&height=100" alt="Don't forget your alt text" />
 46:  * Resizing and cropping a JPEG into a square:
 47:  * <img src="/image.php?url=image-name.jpg?width=100&height=100&cropratio=1:1" alt="Don't forget your alt text" />
 48:  * Matting a PNG with #990000:
 49:  * <img src="/image.php?url=image-name.png?color=900&image=/path/to/image.png" alt="Don't forget your alt text" />
 50:  * Apply a filter:
 51:  * <img src="/image.php?url=/path/to/image.png&filter=IMG_FILTER_COLORIZE,128,60,256" alt="Don't forget the alt text" />
 52:  * Apply more filters (array) :
 53:  * <img src="/image.php?url=/path/to/image.png&filter[]=IMG_FILTER_GRAYSCALE&filter[]=IMG_FILTER_COLORIZE,128,60,256" />
 54:  * Round the image corners:
 55:  * All corners with same radius:
 56:  * <img src="/image.php?url=/path/to/image.png&radius=20" alt="Don't forget your alt text" />
 57:  * Left and right corners with different radius (20 for left corners and 40 for right corners)
 58:  * <img src="/image.php?url=/path/to/image.png&radius=20,40" alt="Don't forget your alt text" />
 59:  * 4 corners, 4 radius, clockwise order
 60:  * <img src="/image.php?url=/path/to/image.png&radius=20,40,0,10" alt="Don't forget your alt text" />
 61:  *
 62:  */
 63: define('MEMORY_TO_ALLOCATE', '100M');
 64: define('DEFAULT_IMAGE_QUALITY', 90);
 65: define('DEFAULT_BACKGROUND_COLOR', '000000');
 66: define('ONLY_LOCAL_IMAGES', true);
 67: define('ENABLE_IMAGEFILTER', true); // Set to false to avoid excessive server load
 68: define('ENABLE_ROUNDCORNER', true); // Set to false to avoid excessive server load
 69: define('ENABLE_IMAGEROTATE', true); // Set to false to avoid excessive server load
 70: 
 71: if (get_magic_quotes_runtime()) {
 72:     set_magic_quotes_runtime(false); // will never get called on PHP 5.4+
 73: }
 74: if (function_exists('mb_http_output')) {
 75:     mb_http_output('pass');
 76: }
 77: 
 78: $xoopsOption['nocommon'] = true;
 79: require_once __DIR__ . '/mainfile.php';
 80: 
 81: include_once __DIR__ . '/include/defines.php';
 82: include_once __DIR__ . '/include/functions.php';
 83: include_once __DIR__ . '/include/version.php';
 84: include_once __DIR__ . '/kernel/object.php';
 85: include_once __DIR__ . '/class/xoopsload.php';
 86: include_once __DIR__ . '/class/preload.php';
 87: include_once __DIR__ . '/class/module.textsanitizer.php';
 88: include_once __DIR__ . '/class/database/databasefactory.php';
 89: require_once __DIR__ . '/class/criteria.php';
 90: XoopsLoad::load('xoopslogger');
 91: $xoopsLogger = XoopsLogger::getInstance();
 92: $xoopsLogger->startTime();
 93: error_reporting(0);
 94: 
 95: /**
 96:  * @param $etag
 97:  * @param $lastModified
 98:  * @return null
 99:  */
100: function doConditionalGet($etag, $lastModified)
101: {
102:     header("Last-Modified: $lastModified");
103:     header("ETag: \"{$etag}\"");
104:     $ifNoneMatch = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : false;
105:     $ifModifiedSince = isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])
106:         ? stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE']) : false;
107:     if (!$ifModifiedSince && !$ifNoneMatch) {
108:         return null;
109:     }
110:     if ($ifNoneMatch && $ifNoneMatch != $etag && $ifNoneMatch != '"' . $etag . '"') {
111:         return null;
112:     } // etag is there but doesn't match
113:     if ($ifModifiedSince && $ifModifiedSince != $lastModified) {
114:         return null;
115:     } // if-modified-since is there but doesn't match
116:     // Nothing has changed since their last request - serve a 304 and exit
117:     header('HTTP/1.1 304 Not Modified');
118:     exit();
119: }
120: 
121: /**
122:  * ref: http://www.tricksofit.com/2014/08/round-corners-on-image-using-php-and-gd-library
123:  *
124:  * @param resource $sourceImage GD Image resource
125:  * @param int[]    $radii       array(top left, top right, bottom left, bottom right) of pixel radius
126:  *                               for each corner. A 0 disables rounding on a corner.
127:  *
128:  * @return resource
129:  */
130: function imageCreateCorners($sourceImage, $radii)
131: {
132:     $q = 2; // quality - improve alpha blending by using larger (*$q) image size
133: 
134:     // find a unique color
135:     $tryCounter = 0;
136:     do {
137:         if (++$tryCounter > 255) {
138:             $r = 2;
139:             $g = 254;
140:             $b = 0;
141:             break;
142:         }
143:         $r = rand(0, 255);
144:         $g = rand(0, 255);
145:         $b = rand(0, 255);
146:     } while (imagecolorexact($sourceImage, $r, $g, $b) < 0);
147: 
148:     $imageWidth = imagesx($sourceImage);
149:     $imageHeight = imagesy($sourceImage);
150: 
151:     $workingWidth = $imageWidth * $q;
152:     $workingHeight = $imageHeight * $q;
153: 
154:     $workingImage= imagecreatetruecolor($workingWidth, $workingHeight);
155:     $alphaColor = imagecolorallocatealpha($workingImage, $r, $g, $b, 127);
156:     imagealphablending($workingImage, false);
157:     imagesavealpha($workingImage, true);
158:     imagefilledrectangle($workingImage, 0, 0, $workingWidth, $workingHeight, $alphaColor);
159: 
160:     imagefill($workingImage, 0, 0, $alphaColor);
161:     imagecopyresampled($workingImage, $sourceImage, 0, 0, 0, 0, $workingWidth, $workingHeight, $imageWidth, $imageHeight);
162:     if (0 < ($radius = $radii[0] * $q)) { // left top
163:         imagearc($workingImage, $radius - 1, $radius - 1, $radius * 2, $radius * 2, 180, 270, $alphaColor);
164:         imagefilltoborder($workingImage, 0, 0, $alphaColor, $alphaColor);
165:     }
166:     if (0 < ($radius = $radii[1] * $q)) { // right top
167:         imagearc($workingImage, $workingWidth - $radius, $radius - 1, $radius * 2, $radius * 2, 270, 0, $alphaColor);
168:         imagefilltoborder($workingImage, $workingWidth - 1, 0, $alphaColor, $alphaColor);
169:     }
170:     if (0 < ($radius = $radii[2] * $q)) { // left bottom
171:         imagearc($workingImage, $radius - 1, $workingHeight - $radius, $radius * 2, $radius * 2, 90, 180, $alphaColor);
172:         imagefilltoborder($workingImage, 0, $workingHeight - 1, $alphaColor, $alphaColor);
173:     }
174:     if (0 < ($radius = $radii[3] * $q)) { // right bottom
175:         imagearc($workingImage, $workingWidth - $radius, $workingHeight - $radius, $radius * 2, $radius * 2, 0, 90, $alphaColor);
176:         imagefilltoborder($workingImage, $workingWidth - 1, $workingHeight - 1, $alphaColor, $alphaColor);
177:     }
178:     imagealphablending($workingImage, true);
179:     imagecolortransparent($workingImage, $alphaColor);
180: 
181:     // scale back down to original size
182:     $destinationImage = imagecreatetruecolor($imageWidth, $imageHeight);
183:     imagealphablending($destinationImage, false);
184:     imagesavealpha($destinationImage, true);
185:     imagefilledrectangle($destinationImage, 0, 0, $imageWidth, $imageHeight, $alphaColor);
186:     imagecopyresampled($destinationImage, $workingImage, 0, 0, 0, 0, $imageWidth, $imageHeight, $workingWidth, $workingHeight);
187: 
188:     // imagedestroy($sourceImage);
189:     imagedestroy($workingImage);
190: 
191:     return $destinationImage;
192: }
193: 
194: /**
195:  * @param $orig
196:  * @param $final
197:  *
198:  * @return mixed
199:  */
200: function findSharp($orig, $final)
201: {
202:     // Function from Ryan Rud (http://adryrun.com)
203:     $final *= (750.0 / $orig);
204:     $a = 52;
205:     $b = -0.27810650887573124;
206:     $c = .00047337278106508946;
207:     $result = $a + $b * $final + $c * $final * $final;
208: 
209:     return max(round($result), 0);
210: }
211: 
212: /**
213:  * issue an error for bad request
214:  *
215:  * Many different issues end up here, so message is generic 404. This keeps us from leaking info by probing
216:  */
217: function exit404BadReq()
218: {
219:     header('HTTP/1.1 404 Not Found');
220:     exit();
221: }
222: 
223: /**
224:  * check local image url for possible issues
225:  *
226:  * @param string $imageUrl url to local image starting at site root with a '/'
227:  *
228:  * @return bool true if name is acceptable, exit if not
229:  */
230: function imageFilenameCheck($imageUrl)
231: {
232:     if ($imageUrl[0] !== '/') { // must start with slash
233:         exit404BadReq();
234:     }
235: 
236:     if ($imageUrl === '/') { // can't be empty
237:         exit404BadReq();
238:     }
239: 
240:     if (preg_match('/(\.\.|<|>|\:|[[:cntrl:]])/', $imageUrl)) { // no "..", "<", ">", ":" or controls
241:         exit404BadReq();
242:     }
243: 
244:     $fullPath = XOOPS_ROOT_PATH . $imageUrl;
245:     if (strpos($fullPath, XOOPS_VAR_PATH) === 0) { // no access to data (shouldn't be in root, but...)
246:         exit404BadReq();
247:     }
248:     if (strpos($fullPath, XOOPS_PATH) === 0) { // no access to lib (shouldn't be in root, but...)
249:         exit404BadReq();
250:     }
251: 
252:     return true;
253: }
254: 
255: /*
256:  * Get image
257:  */
258: // Get id (Xoops image) or url or src (standard image)
259: $imageId = isset($_GET['id']) ? (int)$_GET['id'] : false;
260: $imageUrl = isset($_GET['url']) ? (string)$_GET['url'] : (isset($_GET['src']) ? (string)$_GET['src'] : false);
261: if (!empty($imageId)) {
262:     // If image is a Xoops image
263:     /* @var $imageHandler XoopsImageHandler */
264:     $imageHandler = xoops_getHandler('image');
265:     $criteria = new CriteriaCompo(new Criteria('i.image_display', true));
266:     $criteria->add(new Criteria('i.image_id', $imageId));
267:     $images = $imageHandler->getObjects($criteria, false, true);
268:     if (count($images) != 1) {
269:         // No Xoops images or to many Xoops images
270:         header('Content-type: image/gif');
271:         readfile(XOOPS_UPLOAD_PATH . '/blank.gif');
272:         exit();
273:     }
274:     $image = $images[0];
275:     // Get image category
276:     $imgcatId = $image->getVar('imgcat_id');
277:     $imgcatHandler = xoops_getHandler('imagecategory');
278:     if (!$imgcat = $imgcatHandler->get($imgcatId)) {
279:         // No Image category
280:         header('Content-type: image/gif');
281:         readfile(XOOPS_UPLOAD_PATH . '/blank.gif');
282:         exit();
283:     }
284:     // Get image data
285:     $imageFilename = $image->getVar('image_name'); // image filename
286:     $imageMimetype = $image->getVar('image_mimetype');
287:     $imageCreatedTime = $image->getVar('image_created'); // image creation date
288:     if ($imgcat->getVar('imgcat_storetype') === 'db') {
289:         $imagePath = null;
290:         $imageData = $image->getVar('image_body');
291:     } else {
292:         $imagePath = XOOPS_UPLOAD_PATH . '/' . $image->getVar('image_name');
293:         $imageData = file_get_contents($imagePath);
294:     }
295:     $sourceImage = imagecreatefromstring($imageData);
296:     $imageWidth = imagesx($sourceImage);
297:     $imageHeight = imagesy($sourceImage);
298: } elseif (!empty($imageUrl)) {
299:     // If image is a standard image
300:     if (ONLY_LOCAL_IMAGES) {
301:         // Images must be local files, so for convenience we strip the domain if it's there
302:         $imageUrl = str_replace(XOOPS_URL, '', $imageUrl);
303: 
304:         // will exit on any unacceptable urls
305:         imageFilenameCheck($imageUrl);
306: 
307:         $imagePath = XOOPS_ROOT_PATH . $imageUrl;
308:         if (!file_exists($imagePath)) {
309:             exit404BadReq();
310:         }
311:     } else {
312:         if ($imageUrl{0} === '/') {
313:             $imageUrl = substr($imageUrl, 0, 1);
314:         }
315:         $imagePath = $imageUrl;
316:     }
317:     // Get the size and MIME type of the requested image
318:     $imageFilename = basename($imagePath);  // image filename
319:     $imagesize = getimagesize($imagePath);
320:     $imageWidth = $imagesize[0];
321:     $imageHeight = $imagesize[1];
322:     $imageMimetype = $imagesize['mime'];
323:     $imageCreatedTime = filemtime($imagePath); // image creation date
324:     $imageData = file_get_contents($imagePath);
325:     switch ($imageMimetype) {
326:         case 'image/gif':
327:             $sourceImage = imagecreatefromgif($imagePath);
328:             break;
329:         case 'image/png':
330:             $sourceImage = imagecreatefrompng($imagePath);
331:             break;
332:         case 'image/jpeg':
333:             $sourceImage = imagecreatefromjpeg($imagePath);
334:             break;
335:         default:
336:             exit404BadReq();
337:             break;
338:     }
339: } else {
340:     // No id, no url, no src parameters
341:     header('Content-type: image/gif');
342:     readfile(XOOPS_ROOT_PATH . '/uploads/blank.gif');
343:     exit();
344: }
345: 
346: /*
347:  * Use Xoops cache
348:  */
349: // Get image_data from the Xoops cache only if the edited image has been cached after the latest modification
350: // of the original image
351: xoops_load('XoopsCache');
352: $edited_image_filename = 'editedimage_' . md5($_SERVER['REQUEST_URI']) . '_' . $imageFilename;
353: $cached_image = XoopsCache::read($edited_image_filename);
354: if (!isset($_GET['nocache']) && !isset($_GET['noservercache']) && !empty($cached_image)
355:     && ($cached_image['cached_time'] >= $imageCreatedTime)) {
356:     header("Content-type: {$imageMimetype}");
357:     header('Content-Length: ' . strlen($cached_image['image_data']));
358:     echo $cached_image['image_data'];
359:     exit();
360: }
361: 
362: /*
363:  * Get/check editing parameters
364:  */
365: // width, height
366: $max_width = isset($_GET['width']) ? (int)$_GET['width'] : false;
367: $max_height = isset($_GET['height']) ? (int)$_GET['height'] : false;
368: // If either a max width or max height are not specified, we default to something large so the unspecified
369: // dimension isn't a constraint on our resized image.
370: // If neither are specified but the color is, we aren't going to be resizing at all, just coloring.
371: if (!$max_width && $max_height) {
372:     $max_width = PHP_INT_MAX;
373: } elseif ($max_width && !$max_height) {
374:     $max_height = PHP_INT_MAX;
375: } elseif (!$max_width && !$max_height) {
376:     $max_width = $imageWidth;
377:     $max_height = $imageHeight;
378: }
379: 
380: // color
381: $color = isset($_GET['color']) ? preg_replace('/[^0-9a-fA-F]/', '', (string)$_GET['color']) : false;
382: 
383: // filter, radius, angle
384: $filter = isset($_GET['filter']) ? $_GET['filter'] : false;
385: $radius = isset($_GET['radius']) ? (string)$_GET['radius'] : false;
386: $angle = isset($_GET['angle']) ? (float)$_GET['angle'] : false;
387: 
388: // If we don't have a width or height or color or filter or radius or rotate we simply output the original
389: // image and exit
390: if (empty($_GET['width']) && empty($_GET['height']) && empty($_GET['color']) && empty($_GET['filter'])
391:     && empty($_GET['radius']) && empty($_GET['angle'])) {
392:     $last_modified_string = gmdate('D, d M Y H:i:s', $imageCreatedTime) . ' GMT';
393:     $etag = md5($imageData);
394:     doConditionalGet($etag, $last_modified_string);
395:     header("Content-type: {$imageMimetype}");
396:     header('Content-Length: ' . strlen($imageData));
397:     echo $imageData;
398:     exit();
399: }
400: 
401: // cropratio
402: $offset_x = 0;
403: $offset_y = 0;
404: if (isset($_GET['cropratio'])) {
405:     $crop_ratio = explode(':', (string)$_GET['cropratio']);
406:     if (count($crop_ratio) == 2) {
407:         $ratio_computed = $imageWidth / $imageHeight;
408:         $crop_radio_computed = (float)$crop_ratio[0] / (float)$crop_ratio[1];
409:         if ($ratio_computed < $crop_radio_computed) {
410:             // Image is too tall so we will crop the top and bottom
411:             $orig_height = $imageHeight;
412:             $imageHeight = $imageWidth / $crop_radio_computed;
413:             $offset_y = ($orig_height - $imageHeight) / 2;
414:         } elseif ($ratio_computed > $crop_radio_computed) {
415:             // Image is too wide so we will crop off the left and right sides
416:             $orig_width = $imageWidth;
417:             $imageWidth = $imageHeight * $crop_radio_computed;
418:             $offset_x = ($orig_width - $imageWidth) / 2;
419:         }
420:     }
421: }
422: // Setting up the ratios needed for resizing. We will compare these below to determine how to resize the image
423: // (based on height or based on width)
424: $xRatio = $max_width / $imageWidth;
425: $yRatio = $max_height / $imageHeight;
426: if ($xRatio * $imageHeight < $max_height) {
427:     // Resize the image based on width
428:     $tn_height = ceil($xRatio * $imageHeight);
429:     $tn_width = $max_width;
430: } else {
431:     // Resize the image based on height
432:     $tn_width = ceil($yRatio * $imageWidth);
433:     $tn_height = $max_height;
434: }
435: 
436: // quality
437: $quality = isset($_GET['quality']) ? (int)$_GET['quality'] : DEFAULT_IMAGE_QUALITY;
438: 
439: /*
440:  * Start image editing
441:  */
442: // We don't want to run out of memory
443: ini_set('memory_limit', MEMORY_TO_ALLOCATE);
444: 
445: // Set up a blank canvas for our resized image (destination)
446: $destination_image = imagecreatetruecolor($tn_width, $tn_height);
447: 
448: // Set up the appropriate image handling functions based on the original image's mime type
449: switch ($imageMimetype) {
450:     case 'image/gif':
451:         // We will be converting GIFs to PNGs to avoid transparency issues when resizing GIFs
452:         // This is maybe not the ideal solution, but IE6 can suck it
453:         $output_function = 'imagepng';
454:         $imageMimetype = 'image/png'; // We need to convert GIFs to PNGs
455:         $do_sharpen = false;
456:         $quality = round(10 - ($quality / 10)); // We are converting the GIF to a PNG and PNG needs a compression
457:                                                 // level of 0 (no compression) through 9 (max)
458:         break;
459:     case 'image/png':
460:         $output_function = 'imagepng';
461:         $do_sharpen = false;
462:         $quality = round(10 - ($quality / 10)); // PNG needs a compression level of 0 (no compression) through 9
463:         break;
464:     case 'image/jpeg':
465:         $output_function = 'imagejpeg';
466:         $do_sharpen = true;
467:         break;
468:     default:
469:         exit400BadReq();
470:         break;
471: }
472: 
473: // Resample the original image into the resized canvas we set up earlier
474: imagecopyresampled($destination_image, $sourceImage, 0, 0, $offset_x, $offset_y, $tn_width, $tn_height, $imageWidth, $imageHeight);
475: 
476: // Set background color
477: if (in_array($imageMimetype, array('image/gif', 'image/png'))) {
478:     if (!$color) {
479:         // If this is a GIF or a PNG, we need to set up transparency
480:         imagealphablending($destination_image, false);
481:         imagesavealpha($destination_image, true);
482:         $png_transparency = imagecolorallocatealpha($destination_image, 0, 0, 0, 127);
483:         imagefill($destination_image, 0, 0, $png_transparency);
484:     } else {
485:         // Fill the background with the specified color for matting purposes
486:         if ($color[0] === '#') {
487:             $color = substr($color, 1);
488:         }
489:         $background = false;
490:         if (strlen($color) == 6) {
491:             $background = imagecolorallocate(
492:                 $destination_image,
493:                 intval($color[0] . $color[1], 16),
494:                 intval($color[2] . $color[3], 16),
495:                 intval($color[4] . $color[5], 16)
496:             );
497:         } elseif (strlen($color) == 3) {
498:             $background = imagecolorallocate(
499:                 $destination_image,
500:                 intval($color[0] . $color[0], 16),
501:                 intval($color[1] . $color[1], 16),
502:                 intval($color[2] . $color[2], 16)
503:             );
504:         }
505:         if ($background) {
506:             imagefill($destination_image, 0, 0, $background);
507:         }
508:     }
509: } else {
510:     if (!$color) {
511:         $color = DEFAULT_BACKGROUND_COLOR;
512:     }
513:     // Fill the background with the specified color for matting purposes
514:     if ($color[0] === '#') {
515:         $color = substr($color, 1);
516:     }
517:     $background = false;
518:     if (strlen($color) == 6) {
519:         $background = imagecolorallocate(
520:             $destination_image,
521:             intval($color[0] . $color[1], 16),
522:             intval($color[2] . $color[3], 16),
523:             intval($color[4] . $color[5], 16)
524:         );
525:     } elseif (strlen($color) == 3) {
526:         $background = imagecolorallocate(
527:             $destination_image,
528:             intval($color[0] . $color[0], 16),
529:             intval($color[1] . $color[1], 16),
530:             intval($color[2] . $color[2], 16)
531:         );
532:     }
533:     if ($background) {
534:         imagefill($destination_image, 0, 0, $background);
535:     }
536: }
537: 
538: // Imagefilter
539: if (ENABLE_IMAGEFILTER && !empty($filter)) {
540:     $filterSet = (array) $filter;
541:     foreach ($filterSet as $currentFilter) {
542:         $rawFilterArgs = explode(',', $currentFilter);
543:         $filterConst = constant(array_shift($rawFilterArgs));
544:         if (null !== $filterConst) { // skip if unknown constant
545:             $filterArgs = array();
546:             $filterArgs[] = $destination_image;
547:             $filterArgs[] = $filterConst;
548:             foreach ($rawFilterArgs as $tempValue) {
549:                 $filterArgs[] = trim($tempValue);
550:             }
551:             call_user_func_array('imagefilter', $filterArgs);
552:         }
553:     }
554: }
555: 
556: // Round corners
557: if (ENABLE_ROUNDCORNER && !empty($radius)) {
558:     $radii = explode(',', $radius);
559:     switch (count($radii)) {
560:         case 1:
561:             $radii[3] = $radii[2] = $radii[1] = $radii[0];
562:             break;
563:         case 2:
564:             $radii[3] = $radii[0];
565:             $radii[2] = $radii[1];
566:             break;
567:         case 3:
568:             $radii[3] = $radii[0];
569:             break;
570:         case 4:
571:             // NOP
572:             break;
573:     }
574: 
575:     $destination_image = imageCreateCorners($destination_image, $radii);
576:     // we need png to support the alpha corners correctly
577:     if ($imageMimetype === 'image/jpeg') {
578:         $output_function = 'imagepng';
579:         $imageMimetype = 'image/png';
580:         $do_sharpen = false;
581:         $quality = round(10 - ($quality / 10));
582:     }
583: }
584: 
585: // Imagerotate
586: if (ENABLE_IMAGEROTATE && !empty($angle)) {
587:     $destination_image = imagerotate($destination_image, $angle, $background, 0);
588: }
589: 
590: if ($do_sharpen) {
591:     // Sharpen the image based on two things:
592:     // (1) the difference between the original size and the final size
593:     // (2) the final size
594:     $sharpness = findSharp($imageWidth, $tn_width);
595:     $sharpen_matrix = array(
596:         array(-1, -2, -1),
597:         array(-2, $sharpness + 12, -2),
598:         array(-1, -2, -1));
599:     $divisor = $sharpness;
600:     $offset = 0;
601:     imageconvolution($destination_image, $sharpen_matrix, $divisor, $offset);
602: }
603: 
604: // Put the data of the resized image into a variable
605: ob_start();
606: $output_function($destination_image, null, $quality);
607: $imageData = ob_get_contents();
608: ob_end_clean();
609: // Update $image_created_time
610: $imageCreatedTime = time();
611: 
612: // Clean up the memory
613: imagedestroy($sourceImage);
614: imagedestroy($destination_image);
615: 
616: /*
617:  * Write the just edited image into the Xoops cache
618:  */
619: $cached_image['edited_image_filename'] = $edited_image_filename;
620: $cached_image['image_data'] = $imageData;
621: $cached_image['cached_time'] = $imageCreatedTime;
622: XoopsCache::write($edited_image_filename, $cached_image);
623: 
624: /*
625:  * Send the edited image to the browser
626:  */
627: // See if the browser already has the image
628: $last_modified_string = gmdate('D, d M Y H:i:s', $imageCreatedTime) . ' GMT';
629: $etag = md5($imageData);
630: doConditionalGet($etag, $last_modified_string);
631: 
632: header('HTTP/1.1 200 OK');
633: // if image is cacheable
634: if (!isset($_GET['nocache']) && !isset($_GET['nobrowsercache'])) {
635:     header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $imageCreatedTime) . 'GMT');
636:     header('Cache-control: max-age=31536000');
637:     header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . 'GMT');
638: } else {
639:     // "Kill" the browser cache
640:     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // past date
641:     header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
642:     header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
643:     header('Cache-Control: post-check=0, pre-check=0', false);
644:     header('Pragma: no-cache'); // HTTP/1.0
645: }
646: header("Content-type: {$imageMimetype}");
647: header("Content-disposition: filename={$imageFilename}");
648: header('Content-Length: ' . strlen($imageData));
649: echo $imageData;
650: 
API documentation generated by ApiGen