diff options
author | pavelkproductengine <pavelkproductengine@lindenlab.com> | 2016-07-18 19:54:00 +0300 |
---|---|---|
committer | pavelkproductengine <pavelkproductengine@lindenlab.com> | 2016-07-18 19:54:00 +0300 |
commit | 9c7b7d13c7e9c0c2376c90d94a60962608fe979d (patch) | |
tree | 7d63ae383ea1108243cf93a0710c346f9195cc65 /indra/newview/lloutfitgallery.cpp | |
parent | b3fd315053d5414c9ad46068a096a9f7bad3ad40 (diff) |
MAINT-6476 VOB - User can add any size image to an Outfit Gallery outfit folders
Added restriction of image size that can be added to outfit
Diffstat (limited to 'indra/newview/lloutfitgallery.cpp')
-rw-r--r-- | indra/newview/lloutfitgallery.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index fc736056b9..a65ab26c52 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -41,11 +41,13 @@ #include "llfloaterperms.h" #include "llfloaterreg.h" #include "llfloateroutfitsnapshot.h" +#include "llimagedimensionsinfo.h" #include "llinventoryfunctions.h" #include "llinventorymodel.h" #include "lllocalbitmaps.h" #include "llnotificationsutil.h" #include "lltexturectrl.h" +#include "lltrans.h" #include "llviewercontrol.h" #include "llviewermenufile.h" #include "llviewertexturelist.h" @@ -1057,6 +1059,36 @@ void LLOutfitGallery::uploadPhoto(LLUUID outfit_id) LLLocalBitmap* unit = new LLLocalBitmap(filename); if (unit->getValid()) { + std::string exten = gDirUtilp->getExtension(filename); + U32 codec = LLImageBase::getCodecFromExtension(exten); + + LLImageDimensionsInfo image_info; + std::string image_load_error; + if (!image_info.load(filename, codec)) + { + image_load_error = image_info.getLastError(); + } + + S32 max_width = gSavedSettings.getS32("max_texture_dimension_X"); + S32 max_height = gSavedSettings.getS32("max_texture_dimension_Y"); + + if ((image_info.getWidth() > max_width) || (image_info.getHeight() > max_height)) + { + LLStringUtil::format_map_t args; + args["WIDTH"] = llformat("%d", max_width); + args["HEIGHT"] = llformat("%d", max_height); + + image_load_error = LLTrans::getString("texture_load_dimensions_error", args); + } + + if (!image_load_error.empty()) + { + LLSD subst; + subst["REASON"] = image_load_error; + LLNotificationsUtil::add("ImageLoadError", subst); + return; + } + S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass). void *nruserdata = NULL; nruserdata = (void *)&outfit_id; |