@ -13,6 +13,7 @@ import org.thoughtcrime.securesms.mms.MediaConstraints;
import org.thoughtcrime.securesms.mms.MediaStream ;
import org.thoughtcrime.securesms.mms.MmsException ;
import org.thoughtcrime.securesms.transport.UndeliverableMessageException ;
import org.thoughtcrime.securesms.util.MediaUtil ;
import org.thoughtcrime.securesms.util.Util ;
import org.whispersystems.jobqueue.JobParameters ;
@ -50,8 +51,8 @@ public abstract class SendJob extends MasterSecretJob {
}
}
protected List < Attachment > scaleA ttachments( @NonNull MediaConstraints constraints ,
@NonNull List < Attachment > attachments )
protected List < Attachment > scaleA ndStripExifFromA ttachments( @NonNull MediaConstraints constraints ,
@NonNull List < Attachment > attachments )
throws UndeliverableMessageException
{
AttachmentDatabase attachmentDatabase = DatabaseFactory . getAttachmentDatabase ( context ) ;
@ -60,7 +61,12 @@ public abstract class SendJob extends MasterSecretJob {
for ( Attachment attachment : attachments ) {
try {
if ( constraints . isSatisfied ( context , attachment ) ) {
results . add ( attachment ) ;
if ( MediaUtil . isJpeg ( attachment ) ) {
MediaStream stripped = constraints . getResizedMedia ( context , attachment ) ;
results . add ( attachmentDatabase . updateAttachmentData ( attachment , stripped ) ) ;
} else {
results . add ( attachment ) ;
}
} else if ( constraints . canResize ( attachment ) ) {
MediaStream resized = constraints . getResizedMedia ( context , attachment ) ;
results . add ( attachmentDatabase . updateAttachmentData ( attachment , resized ) ) ;