PHP Class Utilities, BicBucStriim

Afficher le fichier Open project: rvolz/BicBucStriim Class Usage Examples

Méthodes publiques

Méthode Description
bookPath ( string $cd, string $bp, string $file ) : string Return the true path of a book.
stringStartsWith ( string $haystack, string $needle ) : boolean Check if a string starts with a substring.
titleMimeType ( string $file_path ) : string Return the MIME type for an ebook file.
transparentImage ( integer $width, integer $height ) : image Create an image with transparent background.

Method Details

bookPath() static public méthode

Works around a strange feature of Calibre where middle components of names are capitalized, eg "Aliette de Bodard" -> "Aliette De Bodard". The directory name uses the capitalized form, the book path stored in the DB uses the original form.
static public bookPath ( string $cd, string $bp, string $file ) : string
$cd string Calibre library directory
$bp string book path, as stored in the DB
$file string file name
Résultat string the filesystem path to the book file

stringStartsWith() static public méthode

Works around a strange feature of Calibre where middle components of names are capitalized, eg "Aliette de Bodard" -> "Aliette De Bodard". The directory name uses the capitalized form, the book path stored in the DB uses the original form.
static public stringStartsWith ( string $haystack, string $needle ) : boolean
$haystack string String to be searched
$needle string String to search for
Résultat boolean true if $haystack starts with $needle, case insensitive

titleMimeType() static public méthode

To reduce search time the function checks first wether the file has a well known extension. If not two functions are tried. If all fails 'application/force-download' is returned to force the download of the unknown format.
static public titleMimeType ( string $file_path ) : string
$file_path string path to ebook file
Résultat string MIME type

transparentImage() static public méthode

see http://stackoverflow.com/questions/279236/how-do-i-resize-pngs-with-transparency-in-php#279310
static public transparentImage ( integer $width, integer $height ) : image
$width integer
$height integer
Résultat image