@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove some old image transform code with no callsites

Summary: Ref T13101. Ref T5258. This old image transform code no longer has callsites.

Test Plan: Grepped for removed methods, no hits.

Maniphest Tasks: T13101, T5258

Differential Revision: https://secure.phabricator.com/D19198

-75
-75
src/applications/files/PhabricatorImageTransformer.php
··· 20 20 )); 21 21 } 22 22 23 - public function executeConpherenceTransform( 24 - PhabricatorFile $file, 25 - $top, 26 - $left, 27 - $width, 28 - $height) { 29 - 30 - $image = $this->crasslyCropTo( 31 - $file, 32 - $top, 33 - $left, 34 - $width, 35 - $height); 36 - 37 - return PhabricatorFile::newFromFileData( 38 - $image, 39 - array( 40 - 'name' => 'conpherence-'.$file->getName(), 41 - 'profile' => true, 42 - 'canCDN' => true, 43 - )); 44 - } 45 - 46 - private function crasslyCropTo(PhabricatorFile $file, $top, $left, $w, $h) { 47 - $data = $file->loadFileData(); 48 - $src = imagecreatefromstring($data); 49 - $dst = $this->getBlankDestinationFile($w, $h); 50 - 51 - $scale = self::getScaleForCrop($file, $w, $h); 52 - $orig_x = $left / $scale; 53 - $orig_y = $top / $scale; 54 - $orig_w = $w / $scale; 55 - $orig_h = $h / $scale; 56 - 57 - imagecopyresampled( 58 - $dst, 59 - $src, 60 - 0, 0, 61 - $orig_x, $orig_y, 62 - $w, $h, 63 - $orig_w, $orig_h); 64 - 65 - return self::saveImageDataInAnyFormat($dst, $file->getMimeType()); 66 - } 67 - 68 - private function getBlankDestinationFile($dx, $dy) { 69 - $dst = imagecreatetruecolor($dx, $dy); 70 - imagesavealpha($dst, true); 71 - imagefill($dst, 0, 0, imagecolorallocatealpha($dst, 255, 255, 255, 127)); 72 - 73 - return $dst; 74 - } 75 - 76 - public static function getScaleForCrop( 77 - PhabricatorFile $file, 78 - $des_width, 79 - $des_height) { 80 - 81 - $metadata = $file->getMetadata(); 82 - $width = $metadata[PhabricatorFile::METADATA_IMAGE_WIDTH]; 83 - $height = $metadata[PhabricatorFile::METADATA_IMAGE_HEIGHT]; 84 - 85 - if ($height < $des_height) { 86 - $scale = $height / $des_height; 87 - } else if ($width < $des_width) { 88 - $scale = $width / $des_width; 89 - } else { 90 - $scale_x = $des_width / $width; 91 - $scale_y = $des_height / $height; 92 - $scale = max($scale_x, $scale_y); 93 - } 94 - 95 - return $scale; 96 - } 97 - 98 23 private function applyMemeToFile( 99 24 PhabricatorFile $file, 100 25 $upper_text,