PHP 클래스 AvatarModel, huge

상속: extends Model
파일 보기 프로젝트 열기: panique/huge 1 사용 예제들

공개 메소드들

메소드 설명
createAvatar ( ) Create an avatar picture (and checks all necessary things too) TODO decouple TODO total rebuild
deleteAvatar ( integer $userId ) : boolean Delete a user's avatar
deleteAvatarImageFile ( integer $userId ) : boolean Removes the avatar image file from the filesystem
getGravatarLinkByEmail ( string $email ) : string Gets a gravatar image link from given email address
getPublicAvatarFilePathOfUser ( integer $user_has_avatar, integer $user_id ) : string Gets the user's avatar file path
getPublicUserAvatarFilePathByUserId ( $user_id ) : string Gets the user's avatar file path
isAvatarFolderWritable ( ) : boolean Checks if the avatar folder exists and is writable
resizeAvatarImage ( string $source_image, string $destination, integer $final_width = 44, integer $final_height = 44 ) : boolean Resize avatar image (while keeping aspect ratio and cropping it off in a clean way).
validateImageFile ( ) : boolean Validates the image Only accepts gif, jpg, png types
writeAvatarToDatabase ( $user_id ) Writes marker to database, saying user has an avatar now

메소드 상세

createAvatar() 공개 정적인 메소드

Create an avatar picture (and checks all necessary things too) TODO decouple TODO total rebuild
public static createAvatar ( )

deleteAvatar() 공개 정적인 메소드

Delete a user's avatar
public static deleteAvatar ( integer $userId ) : boolean
$userId integer
리턴 boolean success

deleteAvatarImageFile() 공개 정적인 메소드

Removes the avatar image file from the filesystem
public static deleteAvatarImageFile ( integer $userId ) : boolean
$userId integer
리턴 boolean

getGravatarLinkByEmail() 공개 정적인 메소드

Gravatar is the #1 (free) provider for email address based global avatar hosting. The URL (or image) returns always a .jpg file ! For deeper info on the different parameter possibilities:
또한 보기: http://gravatar.com/site/implement/images/
public static getGravatarLinkByEmail ( string $email ) : string
$email string The email address
리턴 string

getPublicAvatarFilePathOfUser() 공개 정적인 메소드

Gets the user's avatar file path
public static getPublicAvatarFilePathOfUser ( integer $user_has_avatar, integer $user_id ) : string
$user_has_avatar integer Marker from database
$user_id integer User's id
리턴 string Avatar file path

getPublicUserAvatarFilePathByUserId() 공개 정적인 메소드

Gets the user's avatar file path
public static getPublicUserAvatarFilePathByUserId ( $user_id ) : string
$user_id integer The user's id
리턴 string avatar picture path

isAvatarFolderWritable() 공개 정적인 메소드

Checks if the avatar folder exists and is writable
public static isAvatarFolderWritable ( ) : boolean
리턴 boolean success status

resizeAvatarImage() 공개 정적인 메소드

Only works with gif, jpg and png file types. If you want to change this also have a look into method validateImageFile() inside this model. TROUBLESHOOTING: You don't see the new image ? Press F5 or CTRL-F5 to refresh browser cache.
public static resizeAvatarImage ( string $source_image, string $destination, integer $final_width = 44, integer $final_height = 44 ) : boolean
$source_image string The location to the original raw image
$destination string The location to save the new image
$final_width integer The desired width of the new image
$final_height integer The desired height of the new image
리턴 boolean success state

validateImageFile() 공개 정적인 메소드

Validates the image Only accepts gif, jpg, png types
또한 보기: http://php.net/manual/en/function.image-type-to-mime-type.php
public static validateImageFile ( ) : boolean
리턴 boolean

writeAvatarToDatabase() 공개 정적인 메소드

Writes marker to database, saying user has an avatar now
public static writeAvatarToDatabase ( $user_id )
$user_id