{"record":{"id":"6ff24c8b4127ad9a","repo":"phacility/phabricator","slug":"this-image-with-dimensions-spx-x-spx-is-too-la","errorCode":null,"errorMessage":"This image (with dimensions %spx x %spx) is too large to transform. The image has %s pixels, but transforms are limited to images with %s or fewer pixels.","messagePattern":"This image \\(with dimensions (.+?)px x (.+?)px\\) is too large to transform\\. The image has (.+?) pixels, but transforms are limited to images with (.+?) or fewer pixels\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/files/transform/PhabricatorFileImageTransform.php","lineNumber":337,"sourceCode":"    if ($info === false) {\n      throw new Exception(\n        pht(\n          'Unable to get image information with getimagesize(): %s',\n          $errors));\n    }\n\n    list($width, $height) = $info;\n    if (($width <= 0) || ($height <= 0)) {\n      throw new Exception(\n        pht(\n          'Unable to determine image width and height with getimagesize().'));\n    }\n\n    $max_pixels = (4096 * 4096);\n    $img_pixels = ($width * $height);\n\n    if ($img_pixels > $max_pixels) {\n      throw new Exception(\n        pht(\n          'This image (with dimensions %spx x %spx) is too large to '.\n          'transform. The image has %s pixels, but transforms are limited '.\n          'to images with %s or fewer pixels.',\n          new PhutilNumber($width),\n          new PhutilNumber($height),\n          new PhutilNumber($img_pixels),\n          new PhutilNumber($max_pixels)));\n    }\n\n    $trap = new PhutilErrorTrap();\n    $image = @imagecreatefromstring($data);\n    $errors = $trap->getErrorsAsString();\n    $trap->destroy();\n\n    if ($image === false) {\n      throw new Exception(\n        pht(","sourceCodeStart":319,"sourceCodeEnd":355,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/files/transform/PhabricatorFileImageTransform.php#L319-L355","documentation":"The pre-flight dimension check computed width*height and found more pixels than the hard cap of 4096*4096 = 16,777,216 pixels. This bounds the memory GD would need to decode the bitmap (each pixel costing several bytes in both source and destination buffers). The message includes the dimensions, the pixel count, and the cap as formatted numbers.","triggerScenarios":"Transforming any image larger than 4096x4096 pixels — e.g. 6000x4000 camera JPEGs, stitched panoramas, high-resolution scans, or large design exports — once a thumbnail or crop transform is requested.","commonSituations":"Modern phone camera defaults (12-50MP) exceed the cap outright; users exporting print-resolution PNGs; galleries that request thumbnails for every upload, hitting the cap on the first render of a large photo.","solutions":["Downscale uploads before they reach Phabricator (client-side resize, or an upload pipeline step) so images stay at or under 4096x4096.","Skip transforms for oversized images and serve the original file.","If policy allows, patch the $max_pixels constant in a fork — but first confirm PHP memory_limit can absorb decoding such images."],"exampleFix":"// before\n$thumb = $file->applyTransform($xform); // throws on 6000x4000 photo\n\n// after\n$info = @getimagesize($file->getURI());\nif ($info && ($info[0] * $info[1]) > (4096 * 4096)) {\n  $thumb = $file; // too many pixels; serve original\n} else {\n  $thumb = $file->applyTransform($xform);\n}","handlingStrategy":"validation","validationCode":"$info = @getimagesize($file->getURI());\nif ($info && ($info[0] * $info[1]) > (4096 * 4096)) {\n  return $file; // over pixel cap; serve original instead of transforming\n}","typeGuard":"function isWithinTransformPixelCap(array $info): bool {\n  return ($info[0] * $info[1]) <= (4096 * 4096);\n}","tryCatchPattern":null,"preventionTips":["Remember modern phone photos (12MP+) exceed the 4096x4096 cap; downscale on the client before upload.","Check width*height, not just width — a 100x200000 image is also over cap.","Pair the pixel check with the 16MB byte-size check for a complete pre-flight."],"tags":["phabricator","image-transform","dimensions","limit","php"],"backgroundTag":"image-dimensions-limit-exceeded","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}