@@ -29,6 +29,7 @@ import android.widget.PopupMenu
2929import android.widget.TextView
3030import android.widget.Toast
3131import org.wordpress.android.util.AppLog
32+ import org.wordpress.android.util.ImageUtils
3233import org.wordpress.android.util.PermissionUtils
3334import org.wordpress.android.util.ToastUtils
3435import org.wordpress.aztec.*
@@ -183,7 +184,6 @@ class MainActivity : AppCompatActivity(),
183184 val options = BitmapFactory .Options ()
184185 options.inDensity = DisplayMetrics .DENSITY_DEFAULT
185186 bitmap = BitmapFactory .decodeFile(mediaPath, options)
186-
187187 insertImageAndSimulateUpload(bitmap, mediaPath)
188188 }
189189 REQUEST_MEDIA_PHOTO -> {
@@ -229,14 +229,16 @@ class MainActivity : AppCompatActivity(),
229229 }
230230
231231 fun insertImageAndSimulateUpload (bitmap : Bitmap ? , mediaPath : String ) {
232+ val bitmapResized = ImageUtils .getScaledBitmapAtLongestSide(bitmap, aztec.visualEditor.maxImagesWidth)
232233 val (id, attrs) = generateAttributesForMedia(mediaPath, isVideo = false )
233- aztec.visualEditor.insertImage(BitmapDrawable (resources, bitmap ), attrs)
234+ aztec.visualEditor.insertImage(BitmapDrawable (resources, bitmapResized ), attrs)
234235 insertMediaAndSimulateUpload(id, attrs)
235236 }
236237
237238 fun insertVideoAndSimulateUpload (bitmap : Bitmap ? , mediaPath : String ) {
239+ val bitmapResized = ImageUtils .getScaledBitmapAtLongestSide(bitmap, aztec.visualEditor.maxImagesWidth)
238240 val (id, attrs) = generateAttributesForMedia(mediaPath, isVideo = true )
239- aztec.visualEditor.insertVideo(BitmapDrawable (resources, bitmap ), attrs)
241+ aztec.visualEditor.insertVideo(BitmapDrawable (resources, bitmapResized ), attrs)
240242 insertMediaAndSimulateUpload(id, attrs)
241243 }
242244
0 commit comments