From 5e05cba3ad53650a97a220585441b94a05259629 Mon Sep 17 00:00:00 2001 From: Adolfo Reyna Date: Sat, 21 Feb 2026 21:35:34 -0500 Subject: [PATCH] Improve mobile photo quality for uploads and media rendering --- Views/NewPost.js | 2 +- Views/ProfileSettings.js | 2 +- components/Media.js | 7 +++++-- components/NewPost.js | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Views/NewPost.js b/Views/NewPost.js index d175ce5..9f358a1 100644 --- a/Views/NewPost.js +++ b/Views/NewPost.js @@ -51,7 +51,7 @@ let NewPostView = (props) => { // Launch image picker to select images from gallery const result = await ImagePicker.launchImageLibraryAsync({ mediaTypes: ImagePicker.MediaTypeOptions.Images, - quality: 0.2, // Set image quality + quality: 0.85, // Avoid aggressive client-side compression before upload allowsMultipleSelection: true, // Allow multiple images to be selected }); if (!result.canceled) { diff --git a/Views/ProfileSettings.js b/Views/ProfileSettings.js index 94c5ee5..87df185 100644 --- a/Views/ProfileSettings.js +++ b/Views/ProfileSettings.js @@ -55,7 +55,7 @@ let ProfileSettings = () => { mediaTypes: ImagePicker.MediaTypeOptions.Images, allowsEditing: true, aspect: [4, 3], - quality: 0.5, + quality: 0.85, //allowsMultipleSelection: true, }); if (!result.canceled) { diff --git a/components/Media.js b/components/Media.js index 355929e..eb41b7c 100644 --- a/components/Media.js +++ b/components/Media.js @@ -1,6 +1,6 @@ // Import necessary dependencies import React, { useState, useEffect } from 'react'; -import { View, TouchableHighlight, StyleSheet, FlatList, TouchableWithoutFeedback, TouchableOpacity, Share } from 'react-native'; +import { View, TouchableHighlight, StyleSheet, FlatList, TouchableWithoutFeedback, TouchableOpacity, Share, Dimensions, PixelRatio } from 'react-native'; import { Button, Text, ProgressBar } from 'react-native-paper'; import API from './../API.js'; import VideoPlayer from './VideoPlayer.js'; @@ -71,7 +71,10 @@ let Media = (props) => { const viewer = gState.me; // Extracting tags from content - const imagesTag = imagesTagF(props.content, props.imageWidth || 1000, props.imageHeight || 1000); + const screenWidth = Dimensions.get('window').width; + const requestedImageWidth = props.imageWidth || Math.max(1200, Math.ceil(screenWidth * PixelRatio.get() * 1.2)); + const requestedImageHeight = props.imageHeight || requestedImageWidth; + const imagesTag = imagesTagF(props.content, requestedImageWidth, requestedImageHeight); const imagesTagLimited = imagesTag.slice(0, 10); const isImagesCapped = imagesTag.length > imagesTagLimited.length; const imageStyle = imagesTag.length === 1 ? styles.image : styles.multipleImage; diff --git a/components/NewPost.js b/components/NewPost.js index c7c3870..9f48d3f 100644 --- a/components/NewPost.js +++ b/components/NewPost.js @@ -21,7 +21,7 @@ let NewPost = ({ profileid, newPostCB }) => { mediaTypes: ImagePicker.MediaTypeOptions.Images, //allowsEditing: true, //aspect: [4, 3], - quality: 0.2, + quality: 0.85, allowsMultipleSelection: true, }); if (!result.canceled) {