예제 #1
0
 private static function computePictureCenter(&$media)
 {
     $filepath = $media->getMedia_filepath();
     $center = ControleurMedia::computeCenter(ControleurMedia::getPictureFilepath($filepath, PictureSizeKind::BIG));
     // Set big center
     $media->setCenter_big($center);
     $size = getimagesize(ControleurMedia::getPictureFilepath($filepath, PictureSizeKind::BIG));
     $width_large = $size[0];
     $height_large = $size[1];
     $tmp = explode(';', $center);
     $x_center_big = $tmp[0];
     $y_center_big = $tmp[1];
     // Compute medium
     $size = getimagesize(ControleurMedia::getPictureFilepath($filepath, PictureSizeKind::MEDIUM));
     $width_medium = $size[0];
     $height_medium = $size[1];
     $x_center_medium = ceil($x_center_big * $width_medium / $width_large);
     $y_center_medium = ceil($y_center_big * $height_medium / $height_large);
     $media->setCenter_medium($x_center_medium . ";" . $y_center_medium);
     // Compute small
     $size = getimagesize(ControleurMedia::getPictureFilepath($filepath, PictureSizeKind::SMALL));
     $width_small = $size[0];
     $height_small = $size[1];
     $x_center_small = ceil($x_center_big * $width_small / $width_large);
     $y_center_small = ceil($y_center_big * $height_small / $height_large);
     $media->setCenter_small($x_center_small . ";" . $y_center_small);
 }
예제 #2
0
파일: Media.php 프로젝트: alexloic/abime
 /**
  * @param string $filepath_small
  * Filepath_small
  * @return Media
  */
 public function setFilepath_small()
 {
     $this->filepath_small = ControleurMedia::getAbsoluteAdress(ControleurMedia::getPictureFilepath($this->getMedia_filepath(), PictureSizeKind::SMALL));
     return $this;
 }