📜 ⬆️ ⬇️

Base of images in any formats and resolutions

Customer: Let the user avatars be 50 × 50 and 100 × 100 in JPEG
Developer: Done

Customer: It is necessary to redo the avatars in PNG
Developer: Made

Customer: Let avatars be in GIF, 25 × 25 and 40 × 40
Developer: Yeah, check
Customer: Already? How do you do it so quickly ???
developer: ...

Something like this

  1. All downloaded images are stored in the original format, which allows you to transform them with minimal loss of quality.
  2. In DOCUMENT ROOT, an empty folder is created in which .htaccess is placed, which, if accessed by a nonexistent file, passes the execution of proxy.php.
  3. proxy.php, depending on whether the request URL matches a certain template, for example /img/avatars/{id}_big.jpg takes an image with id {id}, performs a number of transformations on it, saves the file to the corresponding request and forwards the client to same URL.
  4. When you repeat the request with the same URL, proxy.php is no longer called. The required image file already exists.
To implement such a scheme, there is a Primage library that implements all of the above in a beautiful and concise way.
')

Or rather

On the basis of this Primage , we implement our version of proxy.php :

  1. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  2. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  3. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  4. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  5. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  6. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  7. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  8. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  9. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  10. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  11. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  12. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  13. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  14. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  15. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  16. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  17. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  18. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  19. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  20. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  21. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  22. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  23. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  24. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  25. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  26. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  27. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  28. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  29. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  30. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  31. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  32. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  33. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;
  34. // $avatarsStorage = new Primage_Proxy_Storage ( 'data/avatars' , 'jpg' , 90 ) ; // $avatarsProxyStorage = new Primage_Proxy_Storage ( 'public_html/img/avatars' , 'jpg' , 80 ) ; // URL $router = new Primage_Proxy_Router ( false ) ; // $avatarsBig = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsBig -> addAction ( new Primage_Proxy_Action_Resize ( 200 , 300 ) ) ; $router -> addController ( 'avatars/{id}_big.jpg' , $avatarsBig ) ; // $avatarsSmall = new Primage_Proxy_Controller_CopyById ( $avatarsStorage , $avatarsProxyStorage ) ; $avatarsSmall -> addAction ( new Primage_Proxy_Action_Resize ( 50 , 50 ) ) ; $router -> addController ( 'avatars/{id}_small.jpg' , $avatarsSmall ) ; // ( .. ) $step = 50 ; $maxWidth = 1000 ; $maxHeight = 1000 ; $avatarsDynamic = new Primage_Proxy_Controller_CopyWithResize ( $avatarsStorage , $avatarsProxyStorage , $maxWidth , $maxHeight , $step ) ; $router -> addController ( 'avatars/{id}_{width}x{height}.jpg' , $avatarsDynamic ) ; // $controller = $router -> getController ( $_SERVER [ 'REQUEST_URI' ] , & $params ) ; if ( $controller ) { try { $controller -> dispatch ( $params ) ; header ( 'Location: ' . $_SERVER [ 'REQUEST_URI' ] ) ; exit ; } catch ( Primage_Proxy_Storage_SourceNotFound $e ) { } catch ( Primage_Proxy_Controller_RequestException $e ) { } } header ( 'HTTP/1.0 404 Not Found' ) ;

This is all that was required of us to do, then it is up to Primage, which incidentally includes some more useful functions in terms of organizing the storage and processing of images.

Download the latest version of Primage, subscribe to updates via RSS or participate in the development can be on the project page .

Congratulations to all on the Day of the Programmer Day !!!
Successes to all of us! :)

Source: https://habr.com/ru/post/104094/


All Articles