PHP 클래스 Bkwld\Croppa\URL

파일 보기 프로젝트 열기: bkwld/croppa 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( array $config = [] ) Inject dependencies
buildFilters ( array $options ) : array | null Build filter class instancees
generate ( string $url, integer $width = null, integer $height = null, array $options = null ) : string Insert Croppa parameter suffixes into a URL. For use as a helper in views when rendering image src attributes.
options ( string $option_params ) : array Create options array where each key is an option name and the value if an array of the passed arguments
parse ( string $request ) : array | boolean Parse a request path into Croppa instructions
pathToUrl ( string $path ) : string Append host to the path if it was defined
phpThumbConfig ( array $options ) : array Take options in the URL and options from the config file and produce a config array in the format that PhpThumb expects
relativePath ( string $url ) : string Take a URL or path to an image and get the path relative to the src and crops dirs by using the path config regex
routePattern ( ) : string Make the regex for the route definition. This works by wrapping both the basic Croppa pattern and the path config in positive regex lookaheads so they working like an AND condition.
signingToken ( $url ) : string | void Generate the signing token from a URL or path. Or, if no key was defined, return nothing.
toPath ( string $url ) : string Extract the path from a URL and remove it's leading slash

메소드 상세

__construct() 공개 메소드

Inject dependencies
public __construct ( array $config = [] )
$config array

buildFilters() 공개 메소드

Build filter class instancees
public buildFilters ( array $options ) : array | null
$options array
리턴 array | null Array of filter instances

generate() 공개 메소드

Insert Croppa parameter suffixes into a URL. For use as a helper in views when rendering image src attributes.
public generate ( string $url, integer $width = null, integer $height = null, array $options = null ) : string
$url string URL of an image that should be cropped
$width integer Target width
$height integer Target height
$options array Addtional Croppa options, passed as key/value pairs. Like array('resize')
리턴 string The new path to your thumbnail

options() 공개 메소드

Create options array where each key is an option name and the value if an array of the passed arguments
public options ( string $option_params ) : array
$option_params string Options string in the Croppa URL style
리턴 array

parse() 공개 메소드

Parse a request path into Croppa instructions
public parse ( string $request ) : array | boolean
$request string
리턴 array | boolean | boolean

pathToUrl() 공개 메소드

Append host to the path if it was defined
public pathToUrl ( string $path ) : string
$path string Request path (with leading slash)
리턴 string

phpThumbConfig() 공개 메소드

Take options in the URL and options from the config file and produce a config array in the format that PhpThumb expects
public phpThumbConfig ( array $options ) : array
$options array The url options from `parseOptions()`
리턴 array

relativePath() 공개 메소드

Take a URL or path to an image and get the path relative to the src and crops dirs by using the path config regex
public relativePath ( string $url ) : string
$url string url or path
리턴 string

routePattern() 공개 메소드

https://regex101.com/r/kO6kL1/1 In the Laravel router, this gets wrapped with some extra regex before the matching happnens and for the pattern to match correctly, the final .* needs to exist. Otherwise, the lookaheads have no length and the regex fails https://regex101.com/r/xS3nQ2/1
public routePattern ( ) : string
리턴 string

signingToken() 공개 메소드

Generate the signing token from a URL or path. Or, if no key was defined, return nothing.
public signingToken ( $url ) : string | void
리턴 string | void

toPath() 공개 메소드

Extract the path from a URL and remove it's leading slash
public toPath ( string $url ) : string
$url string
리턴 string path