Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions indra/newview/llfloaterimagepreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,18 @@ bool LLFloaterImagePreview::loadImage(const std::string& src_filename)
return false;
}

// raw image is limited to 256MB so need at least some upper limit that fits into that
constexpr S32 MAX_IMAGE_AREA = 8096 * 8096;

if (image_info.getWidth() * image_info.getHeight() > MAX_IMAGE_AREA)
{
LLStringUtil::format_map_t args;
args["PIXELS"] = llformat("%dM", (S32)(MAX_IMAGE_AREA / 1000000));

mImageLoadError = LLTrans::getString("texture_load_dimensions_error", args);
return false;
}

// Load the image
LLPointer<LLImageFormatted> image = LLImageFormatted::createFromType(codec);
if (image.isNull())
Expand Down
2 changes: 1 addition & 1 deletion indra/newview/skins/default/xui/en/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3970,7 +3970,7 @@ Abuse Report</string>
<string name="AvatarBirthDateFormatShort">[mthnum,datetime,slt]/[day,datetime,slt]</string>

<string name="DefaultMimeType">none/none</string>
<string name="texture_load_dimensions_error">Can't load images larger than [WIDTH]*[HEIGHT]</string>
<string name="texture_load_dimensions_error">Can't load images larger than [PIXELS] pixels</string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might still be confusing. Maybe we could simplify it by stating the limit using only the larger dimension of the image.

Copy link
Contributor Author

@akleshchev akleshchev Aug 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be, but that won't be accurate either. It can be 8Kx8K it can be 32Kx2K or 1Kx64K.We are comparing an area so I think it's the most fair to show an area in the message.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that makes sense.

<string name="texture_load_format_error">Incorrect image format.</string>
<string name="texture_load_empty_file">File is empty.</string>
<string name="outfit_photo_load_dimensions_error">Max outfit photo size is [WIDTH]*[HEIGHT]. Please resize or use another image</string>
Expand Down
Loading