diff options
-rw-r--r-- | indra/newview/llfacebookconnect.cpp | 23 | ||||
-rw-r--r-- | indra/newview/llfloatersocial.cpp | 6 |
2 files changed, 20 insertions, 9 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 ... diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 7ef8f9f9e3..e305bfd10a 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -137,7 +137,7 @@ BOOL LLSocialPhotoPanel::postBuild() mSucceessLblPanel = getChild<LLUICtrl>("succeeded_panel"); mFailureLblPanel = getChild<LLUICtrl>("failed_panel"); mThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder"); - + LLRect full_screen_rect = getRootView()->getRect(); LLSnapshotLivePreview::Params p; p.rect(full_screen_rect); @@ -145,8 +145,10 @@ BOOL LLSocialPhotoPanel::postBuild() mPreviewHandle = previewp->getHandle(); previewp->setSnapshotType(previewp->SNAPSHOT_WEB); + previewp->setSnapshotFormat(LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG); + //previewp->setSnapshotQuality(98); previewp->setThumbnailPlaceholderRect(getThumbnailPlaceholderRect()); - + return LLPanel::postBuild(); } |