예제 #1
0
파일: Route.php 프로젝트: lawondyss/imager
 public function constructUrl(Application\Request $request, Http\Url $url)
 {
     if ($request->getPresenterName() !== 'Nette:Micro') {
         return;
     }
     // parameter "id" will be name in string or instance of ImageInfo
     $id = $request->getParameter('id');
     if ($id instanceof Imager\ImageInfo) {
         $id = $id->getFilename();
     }
     $parts = explode('.', $id);
     // extension is on last position
     $extension = '.' . array_pop($parts);
     // implode back for case that name contains dots
     $name = implode('.', $parts);
     $width = $request->getParameter('width');
     $height = $request->getParameter('height');
     $quality = $request->getParameter('quality');
     $dimension = Imager\Helpers::createDimensionName($width, $height, $quality);
     return $this->basePath . Imager\Helpers::getSubPath($id) . $name . $dimension . $extension;
 }
예제 #2
0
 /**
  * Returns path for thumbnail of image
  *
  * @param string $name
  * @return string
  */
 private function getThumbnailPath($name)
 {
     return $this->thumbnailsDirectory . Helpers::getSubPath($name) . $name;
 }