Page MenuHomePhabricator

D19198.id45986.diff
No OneTemporary

D19198.id45986.diff

diff --git a/src/applications/files/PhabricatorImageTransformer.php b/src/applications/files/PhabricatorImageTransformer.php
--- a/src/applications/files/PhabricatorImageTransformer.php
+++ b/src/applications/files/PhabricatorImageTransformer.php
@@ -20,81 +20,6 @@
));
}
- public function executeConpherenceTransform(
- PhabricatorFile $file,
- $top,
- $left,
- $width,
- $height) {
-
- $image = $this->crasslyCropTo(
- $file,
- $top,
- $left,
- $width,
- $height);
-
- return PhabricatorFile::newFromFileData(
- $image,
- array(
- 'name' => 'conpherence-'.$file->getName(),
- 'profile' => true,
- 'canCDN' => true,
- ));
- }
-
- private function crasslyCropTo(PhabricatorFile $file, $top, $left, $w, $h) {
- $data = $file->loadFileData();
- $src = imagecreatefromstring($data);
- $dst = $this->getBlankDestinationFile($w, $h);
-
- $scale = self::getScaleForCrop($file, $w, $h);
- $orig_x = $left / $scale;
- $orig_y = $top / $scale;
- $orig_w = $w / $scale;
- $orig_h = $h / $scale;
-
- imagecopyresampled(
- $dst,
- $src,
- 0, 0,
- $orig_x, $orig_y,
- $w, $h,
- $orig_w, $orig_h);
-
- return self::saveImageDataInAnyFormat($dst, $file->getMimeType());
- }
-
- private function getBlankDestinationFile($dx, $dy) {
- $dst = imagecreatetruecolor($dx, $dy);
- imagesavealpha($dst, true);
- imagefill($dst, 0, 0, imagecolorallocatealpha($dst, 255, 255, 255, 127));
-
- return $dst;
- }
-
- public static function getScaleForCrop(
- PhabricatorFile $file,
- $des_width,
- $des_height) {
-
- $metadata = $file->getMetadata();
- $width = $metadata[PhabricatorFile::METADATA_IMAGE_WIDTH];
- $height = $metadata[PhabricatorFile::METADATA_IMAGE_HEIGHT];
-
- if ($height < $des_height) {
- $scale = $height / $des_height;
- } else if ($width < $des_width) {
- $scale = $width / $des_width;
- } else {
- $scale_x = $des_width / $width;
- $scale_y = $des_height / $height;
- $scale = max($scale_x, $scale_y);
- }
-
- return $scale;
- }
-
private function applyMemeToFile(
PhabricatorFile $file,
$upper_text,

File Metadata

Mime Type
text/plain
Expires
Sat, Jun 22, 7:05 PM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6289814
Default Alt Text
D19198.id45986.diff (2 KB)

Event Timeline