Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15306900
D19198.id45986.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D19198.id45986.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 7, 4:31 AM (5 d, 3 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7319420
Default Alt Text
D19198.id45986.diff (2 KB)
Attached To
Mode
D19198: Remove some old image transform code with no callsites
Attached
Detach File
Event Timeline
Log In to Comment