diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp
index fc736056b9576ee51283254d5902ef11b64bd43e..a65ab26c522b1286b0a447ac2e89e29fb09c4523 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;
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 492d96365358902da40464e8613e75b43d654134..f96b8636f5d96f9de11f7039f64f43c7fb98d047 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -11016,4 +11016,16 @@ Cannot create large prims that intersect other players.  Please re-try when othe
      yestext="OK"/>
   </notification>
   
+  
+  <notification
+   icon="alert.tga"
+   name="ImageLoadError"
+   type="alertmodal">
+   [REASON]
+    <tag>fail</tag>
+    <usetemplate
+     name="okbutton"
+     yestext="OK"/>
+  </notification>
+
 </notifications>