Q_Image Class
Q Image class
Item Index
Methods
- applyImage static
- avatar static
- buildIAvatar static
- buildIAvatar static
- buildWAvatar static
- getCenter static
- getSprite static
- hsl2rgb static
- put static
- resize static
- save static
Events
Methods
applyImage
-
$base
-
$part
Helper function for building a wavatar. This loads an image and adds it to our composite using the given color values.
Parameters:
-
$base
GDImageLink -
$part
String
avatar
-
$hash
-
[$size=Q_AVATAR_SIZE]
-
[$type='wavatar']
-
[$gravatar=false]
Returns png avatar image. Can check gravatar.com for avatar
Parameters:
-
$hash
StringThe md5 hash to build avatar
-
[$size=Q_AVATAR_SIZE]
Integer optionalAvatar size in pixels
-
[$type='wavatar']
Object optionalType of avatar - one of 'wavatar', 'monster', 'imageid'
-
[$gravatar=false]
Boolean optional
Returns:
buildIAvatar
-
$hash
-
$size
Builds the avatar.
Parameters:
-
$hash
Integer -
$size
Integer
Returns:
buildIAvatar
-
$hash
-
$size
Builds the avatar.
Parameters:
-
$hash
Integer -
$size
Integer
Returns:
buildWAvatar
-
$hash
-
$size
Builds the avatar.
Parameters:
-
$hash
Integer -
$size
Integer
Returns:
getCenter
-
$shape
-
$fR
-
$fG
-
$fB
-
$bR
-
$bG
-
$bB
-
$usebg
generate sprite for center block
Parameters:
-
$shape
Integer -
$fR
Integer -
$fG
Integer -
$fB
Integer -
$bR
Integer -
$bG
Integer -
$bB
Integer -
$usebg
Integer
Returns:
getSprite
-
$shape
-
$R
-
$G
-
$B
-
$rotation
generate sprite for corners and sides
Parameters:
-
$shape
Integer -
$R
Integer -
$G
Integer -
$B
Integer -
$rotation
Integer
Returns:
hsl2rgb
-
$h
-
$s
-
$l
Handy function for converting hus/sat/lum color values to RGB, which makes it very easy to generate random-yet-still-vibrant colors
Parameters:
-
$h
Integer -
$s
Integer -
$l
Integer
Returns:
RGB vlue as array($R, $G, $B)
put
-
$filename
-
$hash
-
[$size=Q_AVATAR_SIZE]
-
[$type='wavatar']
-
[$gravatar=false]
Saves an avatar image, in a certain size. Can check gravatar.com for avatar
Parameters:
-
$filename
StringThe name of image file
-
$hash
StringThe md5 hash to build avatar
-
[$size=Q_AVATAR_SIZE]
Integer optionalAvatar size in pixels
-
[$type='wavatar']
String optionalType of avatar - one of 'wavatar', 'monster', 'imageid'
-
[$gravatar=false]
Boolean optional
Returns:
resize
-
$in_filename
-
$out_filename
-
$sizes
Resizes an image file and saves it as another file
Parameters:
-
$in_filename
StringThe filename of image to load.
-
$out_filename
StringWhere to save the result. The extension determines the file type to save.
-
$sizes
ArrayAn array of options, including: "width": this lets you specify the width of the result "height": this lets you specify the height of the result "width_max": this lets you specify the max width of the result "height_max": this lets you specify the max height of the result
Returns:
Whether the result was saved successfully
save
-
$params
-
[$params.save=array("x"
Saves an image, usually sent by the client, in one or more sizes.
Parameters:
-
$params
Array-
[data]
String optionalthe image data
-
[path="uploads"]
String optionalparent path under web dir (see subpath)
-
[subpath=""]
String optionalsubpath that should follow the path, to save the image under
-
[merge=""]
String optionalpath under web dir for an optional image to use as a background
-
[crop]
String optionalarray with keys "x", "y", "w", "h" to crop the original image
-
[skipAccess=false]
String optionalif true, skips the check for authorization to write files there
-
-
[$params.save=array("x"
String=> "")] array of $size => $basename pairs where the size is of the format "WxH", and either W or H can be empty.
Returns:
an array of ($size => $fullImagePath) pairs
Events
Q/image/save
After
Event Payload:
-
user
String -
path
String -
subpath
String -
writePath
String -
data
String