|
const | SQL_ERROR = -10 |
|
const | SQL_BLOB_ERROR = -11 |
|
const | TABLE = 'pictures' |
|
const | PK = Adherent::PK |
|
const | INVALID_FILENAME = -1 |
|
const | INVALID_EXTENSION = -2 |
|
const | FILE_TOO_BIG = -3 |
|
const | IMAGE_TOO_SMALL = -4 |
|
const | MIME_NOT_ALLOWED = -5 |
|
const | NEW_FILE_EXISTS = -6 |
|
const | INVALID_FILE = -7 |
|
const | CANT_WRITE = -8 |
|
const | MAX_FILE_SIZE = 2048 |
|
const | MIN_CROP_SIZE = 267 |
|
|
store as | trait_store |
|
getMimeType as | trait_getMimeType |
|
string | $tbl_prefix = '' |
|
string int | $id |
|
int | $db_id |
|
int | $height |
|
int | $width |
|
int | $optimal_height |
|
int | $optimal_width |
|
string | $file_path |
|
string | $format |
|
string | $mime |
|
bool | $has_picture = false |
|
string | $store_path = GALETTE_PHOTOS_PATH |
|
int | $max_width = 200 |
|
int | $max_height = 200 |
|
◆ __construct()
Galette\Core\Picture::__construct |
( |
string|int|null |
$id_adh = null | ) |
|
Default constructor.
- Parameters
-
string | int | null | $id_adh | the id of the member |
◆ __wakeup()
Galette\Core\Picture::__wakeup |
( |
| ) |
|
"Magic" function called on unserialize
- Returns
- void
◆ buildDestPath()
Galette\Core\Picture::buildDestPath |
( |
| ) |
|
|
protected |
Build destination path
- Returns
- string
◆ delete()
Galette\Core\Picture::delete |
( |
bool |
$transaction = true | ) |
|
Deletes a picture, from both database and filesystem
- Parameters
-
boolean | $transaction | Whether to use a transaction here or not |
- Returns
- boolean true if image was successfully deleted, false otherwise
◆ display()
Galette\Core\Picture::display |
( |
Response |
$response | ) |
|
Set header and displays the picture.
- Parameters
-
Response | $response | Response |
- Returns
- Response the binary file
◆ getCheckFileQuery()
Galette\Core\Picture::getCheckFileQuery |
( |
| ) |
|
|
protected |
Returns the relevant query to check if picture exists in database.
- Returns
- Select SELECT query
Reimplemented in Galette\Core\Logo.
◆ getContents()
Galette\Core\Picture::getContents |
( |
| ) |
|
Get image file contents in stdOut
- Returns
- void
◆ getDefaultPicture()
Galette\Core\Picture::getDefaultPicture |
( |
| ) |
|
|
protected |
◆ getErrorMessage()
Galette\Core\Picture::getErrorMessage |
( |
int |
$code | ) |
|
Return textual error message
- Parameters
-
- Returns
- string Localized message
◆ getFormat()
Galette\Core\Picture::getFormat |
( |
| ) |
|
Returns current file format
- Returns
- string
◆ getHeight()
Galette\Core\Picture::getHeight |
( |
| ) |
|
Returns current file height
- Returns
- int current height
◆ getMime()
Galette\Core\Picture::getMime |
( |
| ) |
|
Returns current mime type
- Returns
- string
◆ getMimeType()
static Galette\Core\Picture::getMimeType |
( |
string |
$file | ) |
|
|
static |
Get file mime type
- Parameters
-
- Returns
- string
◆ getOptimalHeight()
Galette\Core\Picture::getOptimalHeight |
( |
| ) |
|
Returns current file optimal height (resized)
- Returns
- int optimal height
◆ getOptimalWidth()
Galette\Core\Picture::getOptimalWidth |
( |
| ) |
|
Returns current file optimal width (resized)
- Returns
- int optimal width
◆ getPath()
Galette\Core\Picture::getPath |
( |
| ) |
|
Returns current file full path
- Returns
- string full file path
◆ getWidth()
Galette\Core\Picture::getWidth |
( |
| ) |
|
Returns current file width
- Returns
- int current width
◆ hasPicture()
Galette\Core\Picture::hasPicture |
( |
| ) |
|
Have we got a picture ?
- Returns
- bool True if a picture matches adherent's id, false otherwise
◆ store()
Galette\Core\Picture::store |
( |
array |
$file, |
|
|
bool |
$ajax = false , |
|
|
array |
$cropping = null |
|
) |
| |
Stores an image on the disk and in the database
- Parameters
-
| array<string,mixed> | $file The uploaded file |
boolean | $ajax | If the image comes from an ajax call (dnd) |
| ?array<string,mixed> | $cropping Cropping properties |
- Returns
- bool|int
◆ writeOnDisk()
Galette\Core\Picture::writeOnDisk |
( |
string |
$tmpfile, |
|
|
bool |
$ajax |
|
) |
| |
Write file on disk
- Parameters
-
string | $tmpfile | Temporary file |
bool | $ajax | If the file comes from an ajax call (dnd) |
- Returns
- bool|int
FIXME: what if image cannot be resized? Should'nt we want to stop the process here?
The documentation for this class was generated from the following file:
- /home/docs/checkouts/readthedocs.org/user_builds/galette-apidoc/checkouts/develop/galette/lib/Galette/Core/Picture.php