summaryrefslogtreecommitdiff
path: root/indra/newview/llfacebookconnect.cpp
diff options
context:
space:
mode:
authorCho <cho@lindenlab.com>2013-06-27 19:34:39 +0100
committerCho <cho@lindenlab.com>2013-06-27 19:34:39 +0100
commit26832818780ffe5052443db3c6bbfca15575a5b5 (patch)
tree05de8446bf07b64112c0e749357aacc71708bc73 /indra/newview/llfacebookconnect.cpp
parent1adc987ed1a90af1fdb4e14bf1ce1674a69389b9 (diff)
changed FBC photo sharing to use JPEG instead of PNG for ACME-636
Diffstat (limited to 'indra/newview/llfacebookconnect.cpp')
-rw-r--r--indra/newview/llfacebookconnect.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp
index fe4e7fe69e..cf0f554149 100644
--- a/indra/newview/llfacebookconnect.cpp
+++ b/indra/newview/llfacebookconnect.cpp
@@ -36,6 +36,7 @@
#include "llnotificationsutil.h"
#include "llurlaction.h"
#include "llimagepng.h"
+#include "llimagejpeg.h"
#include "lltrans.h"
@@ -352,14 +353,22 @@ void LLFacebookConnect::sharePhoto(const std::string& image_url, const std::stri
void LLFacebookConnect::sharePhoto(LLPointer<LLImageFormatted> image, const std::string& caption)
{
- // All this code is mostly copied from LLWebProfile::post()
- if (dynamic_cast<LLImagePNG*>(image.get()) == 0)
+ std::string imageFormat;
+ if (dynamic_cast<LLImagePNG*>(image.get()))
+ {
+ imageFormat = "png";
+ }
+ else if (dynamic_cast<LLImageJPEG*>(image.get()))
+ {
+ imageFormat = "jpg";
+ }
+ else
{
- llwarns << "Image to upload is not a PNG" << llendl;
- llassert(dynamic_cast<LLImagePNG*>(image.get()) != 0);
+ llwarns << "Image to upload is not a PNG or JPEG" << llendl;
return;
}
-
+
+ // All this code is mostly copied from LLWebProfile::post()
const std::string boundary = "----------------------------0123abcdefab";
LLSD headers;
@@ -373,8 +382,8 @@ void LLFacebookConnect::sharePhoto(LLPointer<LLImageFormatted> image, const std:
<< caption << "\r\n";
body << "--" << boundary << "\r\n"
- << "Content-Disposition: form-data; name=\"image\"; filename=\"snapshot.png\"\r\n"
- << "Content-Type: image/png\r\n\r\n";
+ << "Content-Disposition: form-data; name=\"image\"; filename=\"snapshot." << imageFormat << "\"\r\n"
+ << "Content-Type: image/" << imageFormat << "\r\n\r\n";
// Insert the image data.
// *FIX: Treating this as a string will probably screw it up ...