From 26832818780ffe5052443db3c6bbfca15575a5b5 Mon Sep 17 00:00:00 2001 From: Cho Date: Thu, 27 Jun 2013 19:34:39 +0100 Subject: changed FBC photo sharing to use JPEG instead of PNG for ACME-636 --- indra/newview/llfacebookconnect.cpp | 23 ++++++++++++++++------- indra/newview/llfloatersocial.cpp | 6 ++++-- 2 files changed, 20 insertions(+), 9 deletions(-) (limited to 'indra') 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 image, const std::string& caption) { - // All this code is mostly copied from LLWebProfile::post() - if (dynamic_cast(image.get()) == 0) + std::string imageFormat; + if (dynamic_cast(image.get())) + { + imageFormat = "png"; + } + else if (dynamic_cast(image.get())) + { + imageFormat = "jpg"; + } + else { - llwarns << "Image to upload is not a PNG" << llendl; - llassert(dynamic_cast(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 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("succeeded_panel"); mFailureLblPanel = getChild("failed_panel"); mThumbnailPlaceholder = getChild("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(); } -- cgit v1.2.3