Skip to content

Commit ec5fbac

Browse files
authored
Merge pull request #1307 from rlratcliffe/1265-fix-import-image-size-discrepancy
1265 fix import image size discrepancy
2 parents 04d72ca + 95f8966 commit ec5fbac

File tree

14 files changed

+72
-21
lines changed

14 files changed

+72
-21
lines changed

PhotoUploadDevNotes.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Photo Upload
2+
3+
There are currently three places to change the default photo upload size and default max count amount. These three places affect these pages or modals: `Submit -> Report an Encounter`, `Submit -> Report an Encounter (classic)`, `Submit -> Bulk Import`, `Submit -> Bulk Import -> See Instructions`.
4+
5+
This is linked from comments in the relevant files which say: `Refer to PhotoUploadDevNotes.md for information/where else to change`. Non-development properties files are not annotated with this comment since those files will be changed by users.
6+
7+
Order of using:
8+
1. `commonConfiguration.properties`, which each production Wildbook can change if needed
9+
- ./devops/deploy/.dockerfiles/tomcat/commonConfiguration.properties
10+
- ./devops/development/.dockerfiles/tomcat/commonConfiguration.properties
11+
- ./src/main/resources/bundles/commonConfiguration.properties
12+
2. `org/ecocean/CommonConfiguration.java`, first fallback if properties are not initialized
13+
3. `frontend/src/constants/photoUpload.js`, second fallback if SiteSettings is not accessible

devops/deploy/.dockerfiles/tomcat/commonConfiguration.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,9 @@ biologicalMeasurementSamplingProtocols2 = No lipids extracted, uncorrected
329329

330330
#Maximum uploadable media size in megabytes (MB)
331331
#This value is used for encounter images and videos as well as for file associations added to a MarkedIndividual.
332-
maxMediaSize = 40
332+
maxMediaSize = 3
333+
#Maximum number of media per encounter
334+
maximumMediaCountEncounter = 200
333335

334336
#allow video download for not logged in users
335337
videoDLNotLoggedIn = false

devops/development/.dockerfiles/tomcat/commonConfiguration.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,10 @@ biologicalMeasurementSamplingProtocols2 = No lipids extracted, uncorrected
329329

330330
#Maximum uploadable media size in megabytes (MB)
331331
#This value is used for encounter images and videos as well as for file associations added to a MarkedIndividual.
332-
maxMediaSize = 40
332+
# Refer to PhotoUploadDevNotes.md for information/where else to change
333+
maxMediaSize = 3
334+
#Maximum number of media per encounter
335+
maximumMediaCountEncounter = 200
333336

334337
#allow video download for not logged in users
335338
videoDLNotLoggedIn = false
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const defaultMaxMediaSize = 3;
2+
const defaultMaxMediaCount = 200;
3+
// Refer to PhotoUploadDevNotes.md for information/where else to change
4+
5+
export { defaultMaxMediaSize, defaultMaxMediaCount };

frontend/src/locale/de.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,6 @@
374374
"BULK_IMPORT_UPLOAD_IMAGE_DESC_PART_2": "Nur die Formate JPEG, JPG und PNG werden unterstützt. Dateien in anderen Formaten werden ignoriert.",
375375
"BULK_IMPORT_PHOTO_INSTRUCTION": "Ziehe deine Ordner oder Dateien hierher oder durchsuchen zum Hochladen",
376376
"SEE_INSTRUCTIONS": "Anleitung anzeigen",
377-
"BULK_IMPORT_UPLOAD_IMAGE_DESC": "Die Bildnamen müssen der Spalte „Encounter.MediaAsset“ in deiner Wildbook-Standardformat-Tabelle entsprechen. Bilder müssen kleiner als 3 MB sein. Du kannst nur 200 Bilder auf einmal hochladen.",
378377
"BULK_IMPORT_UPLOAD_SPREADSHEET": "Tabelle hochladen",
379378
"BULK_IMPORT_UPLOAD_SPREADSHEET_DESC_PART1": "Lade deine Tabellen-Datei (.csv, .xlsx, .xls) im ",
380379
"BULK_IMPORT_UPLOAD_SPREADSHEET_DESC_PART2": "Wildbook-Standardformat hoch.",
@@ -397,8 +396,8 @@
397396
"BULK_IMPORT_INSTRUCTIONS_STEP1_PLACE_IMAGES": "Lege alle Bilder in einen einzigen Ordner",
398397
"BULK_IMPORT_INSTRUCTIONS_STEP1_IMAGE_REQUIREMENTS": "Bilder müssen:",
399398
"BULK_IMPORT_INSTRUCTIONS_STEP1_FORMAT": "Im JPEG-, JPG- oder PNG-Format sein",
400-
"BULK_IMPORT_INSTRUCTIONS_STEP1_MAX_SIZE": "Weniger als 3 MB sein",
401-
"BULK_IMPORT_INSTRUCTIONS_STEP1_MAX_COUNT": "Nicht mehr als 200 Dateien pro Upload",
399+
"BULK_IMPORT_INSTRUCTIONS_STEP1_MAX_SIZE": "Weniger als {maxSize}MB sein",
400+
"BULK_IMPORT_INSTRUCTIONS_STEP1_MAX_COUNT": "Nicht mehr als {maxImageCount} Dateien pro Upload",
402401
"BULK_IMPORT_INSTRUCTIONS_STEP1_FILENAME_REQUIREMENTS": "Dateinamen müssen",
403402
"BULK_IMPORT_INSTRUCTIONS_STEP1_LETTERS_NUMBERS": "Nur englische Buchstaben, Zahlen, Punkte und Leerzeichen verwenden",
404403
"BULK_IMPORT_INSTRUCTIONS_STEP1_MATCH_ENTRIES": "Genau mit den Einträgen in der Encounter.mediaAsset-Spalte übereinstimmen",

frontend/src/locale/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,8 @@
396396
"BULK_IMPORT_INSTRUCTIONS_STEP1_PLACE_IMAGES": "Place all your images in a single folder",
397397
"BULK_IMPORT_INSTRUCTIONS_STEP1_IMAGE_REQUIREMENTS": "Images must be:",
398398
"BULK_IMPORT_INSTRUCTIONS_STEP1_FORMAT": "JPEG, JPG or PNG format",
399-
"BULK_IMPORT_INSTRUCTIONS_STEP1_MAX_SIZE": "Under 3MB",
400-
"BULK_IMPORT_INSTRUCTIONS_STEP1_MAX_COUNT": "Not exceed 200 files per import",
399+
"BULK_IMPORT_INSTRUCTIONS_STEP1_MAX_SIZE": "Under {maxSize}MB",
400+
"BULK_IMPORT_INSTRUCTIONS_STEP1_MAX_COUNT": "Not exceed {maxImageCount} files per import",
401401
"BULK_IMPORT_INSTRUCTIONS_STEP1_FILENAME_REQUIREMENTS": "Filenames must",
402402
"BULK_IMPORT_INSTRUCTIONS_STEP1_LETTERS_NUMBERS": "Use only letters from the English alphabet, numbers, periods and spaces",
403403
"BULK_IMPORT_INSTRUCTIONS_STEP1_MATCH_ENTRIES": "Exactly match entries in the Encounter.mediaAsset column of your spreadsheet",

frontend/src/locale/es.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,8 @@
395395
"BULK_IMPORT_INSTRUCTIONS_STEP1_PLACE_IMAGES": "Coloca todas tus imágenes en una sola carpeta",
396396
"BULK_IMPORT_INSTRUCTIONS_STEP1_IMAGE_REQUIREMENTS": "Las imágenes deben:",
397397
"BULK_IMPORT_INSTRUCTIONS_STEP1_FORMAT": "Formato JPEG, JPG o PNG",
398-
"BULK_IMPORT_INSTRUCTIONS_STEP1_MAX_SIZE": "Menos de 3 MB",
399-
"BULK_IMPORT_INSTRUCTIONS_STEP1_MAX_COUNT": "No exceder 200 archivos por importación",
398+
"BULK_IMPORT_INSTRUCTIONS_STEP1_MAX_SIZE": "Menos de {maxSize}MB",
399+
"BULK_IMPORT_INSTRUCTIONS_STEP1_MAX_COUNT": "No exceder {maxImageCount} archivos por importación",
400400
"BULK_IMPORT_INSTRUCTIONS_STEP1_FILENAME_REQUIREMENTS": "Los nombres de archivo deben",
401401
"BULK_IMPORT_INSTRUCTIONS_STEP1_LETTERS_NUMBERS": "Usar solo letras en inglés, números, puntos y espacios",
402402
"BULK_IMPORT_INSTRUCTIONS_STEP1_MATCH_ENTRIES": "Coincidir exactamente con las entradas en la columna Encounter.mediaAsset de tu hoja de cálculo",

frontend/src/locale/fr.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,8 @@
395395
"BULK_IMPORT_INSTRUCTIONS_STEP1_PLACE_IMAGES": "Placez toutes vos images dans un seul dossier",
396396
"BULK_IMPORT_INSTRUCTIONS_STEP1_IMAGE_REQUIREMENTS": "Les images doivent :",
397397
"BULK_IMPORT_INSTRUCTIONS_STEP1_FORMAT": "Format JPEG, JPG ou PNG",
398-
"BULK_IMPORT_INSTRUCTIONS_STEP1_MAX_SIZE": "Moins de 3 Mo",
399-
"BULK_IMPORT_INSTRUCTIONS_STEP1_MAX_COUNT": "Ne pas dépasser 200 fichiers par importation",
398+
"BULK_IMPORT_INSTRUCTIONS_STEP1_MAX_SIZE": "Moins de {maxSize}Mo",
399+
"BULK_IMPORT_INSTRUCTIONS_STEP1_MAX_COUNT": "Ne pas dépasser {maxImageCount} fichiers par importation",
400400
"BULK_IMPORT_INSTRUCTIONS_STEP1_FILENAME_REQUIREMENTS": "Les noms de fichiers doivent",
401401
"BULK_IMPORT_INSTRUCTIONS_STEP1_LETTERS_NUMBERS": "Utiliser uniquement des lettres anglaises, des chiffres, des points et des espaces",
402402
"BULK_IMPORT_INSTRUCTIONS_STEP1_MATCH_ENTRIES": "Correspondre exactement aux entrées de la colonne Encounter.mediaAsset",

frontend/src/locale/it.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@
373373
"BULK_IMPORT_UPLOAD_IMAGE_DESC_PART_2": "Sono supportati solo i formati JPEG, JPG e PNG. I file in altri formati verranno ignorati.",
374374
"BULK_IMPORT_PHOTO_INSTRUCTION": "Trascina qui la cartella o i file oppure sfoglia per selezionare i file da caricare",
375375
"SEE_INSTRUCTIONS": "Vedi istruzioni",
376-
"BULK_IMPORT_UPLOAD_IMAGE_DESC": "I nomi delle immagini devono corrispondere alla colonna “Encounter.MediaAsset” del tuo foglio di calcolo nel formato standard di Wildbook. Le immagini devono essere inferiori a 3 MB. Puoi caricare solo 200 immagini alla volta.",
377376
"BULK_IMPORT_UPLOAD_SPREADSHEET": "Carica foglio di calcolo",
378377
"BULK_IMPORT_UPLOAD_SPREADSHEET_DESC_PART1": "Carica il tuo file foglio di calcolo (.csv, .xlsx, .xls) nel ",
379378
"BULK_IMPORT_UPLOAD_SPREADSHEET_DESC_PART2": "Formato standard di Wildbook.",
@@ -396,8 +395,8 @@
396395
"BULK_IMPORT_INSTRUCTIONS_STEP1_PLACE_IMAGES": "Inserisci tutte le immagini in un'unica cartella",
397396
"BULK_IMPORT_INSTRUCTIONS_STEP1_IMAGE_REQUIREMENTS": "Le immagini devono:",
398397
"BULK_IMPORT_INSTRUCTIONS_STEP1_FORMAT": "Essere in formato JPEG, JPG o PNG",
399-
"BULK_IMPORT_INSTRUCTIONS_STEP1_MAX_SIZE": "Essere inferiori a 3 MB",
400-
"BULK_IMPORT_INSTRUCTIONS_STEP1_MAX_COUNT": "Non superare i 200 file per importazione",
398+
"BULK_IMPORT_INSTRUCTIONS_STEP1_MAX_SIZE": "Essere inferiori a {maxSize}MB",
399+
"BULK_IMPORT_INSTRUCTIONS_STEP1_MAX_COUNT": "Non superare i {maxImageCount} file per importazione",
401400
"BULK_IMPORT_INSTRUCTIONS_STEP1_FILENAME_REQUIREMENTS": "I nomi dei file devono",
402401
"BULK_IMPORT_INSTRUCTIONS_STEP1_LETTERS_NUMBERS": "Usare solo lettere inglesi, numeri, punti e spazi",
403402
"BULK_IMPORT_INSTRUCTIONS_STEP1_MATCH_ENTRIES": "Corrispondere esattamente alle voci nella colonna Encounter.mediaAsset",

frontend/src/pages/BulkImport/BulkImportImageUpload.jsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ import { observer } from "mobx-react-lite";
1414
import BulkImportSeeInstructionsButton from "./BulkImportSeeInstructionsButton";
1515
import { FixedSizeList as List } from "react-window";
1616
import { BulkImportImageUploadInfo } from "./BulkImportImageUploadInfo";
17+
import {
18+
defaultMaxMediaSize,
19+
defaultMaxMediaCount,
20+
} from "../../constants/photoUpload.js";
1721

1822
const handleDragOver = (e) => {
1923
e.preventDefault();
@@ -30,11 +34,13 @@ export const BulkImportImageUpload = observer(({ store, renderMode1 }) => {
3034
const theme = useContext(ThemeContext);
3135
const originalBorder = `1px dashed ${theme.primaryColors.primary500}`;
3236
const { data } = useGetSiteSettings();
33-
const maxSize = data?.maximumMediaSizeMegabytes || 40;
37+
const maxSize = data?.maximumMediaSizeMegabytes || defaultMaxMediaSize;
3438
const [isProcessingDrop, setIsProcessingDrop] = useState(false);
3539
const [renderMode, setRenderMode] = useState("grid");
3640
const THUMBNAIL_THRESHOLD = 50;
37-
store.setMaxImageCount(data?.maximumMediaCountEncounter || 200);
41+
store.setMaxImageCount(
42+
data?.maximumMediaCountEncounter || defaultMaxMediaCount,
43+
);
3844
const currentCount = store.imagePreview.length;
3945

4046
useEffect(() => {

0 commit comments

Comments
 (0)