PHP Класс AvatarModel, huge

Наследование: extends Model
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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