Skip to content

Commit

Permalink
Merge pull request #591 from AFP-Medialab/fix-590
Browse files Browse the repository at this point in the history
Do not resize if the image is from an URL
  • Loading branch information
Sallaa authored Sep 13, 2024
2 parents 36dcea3 + 120de94 commit c78cf42
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/components/NavItems/tools/SyntheticImageDetection/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const SyntheticImageDetection = () => {

const [imageType, setImageType] = useState(undefined);

const [autoResizeLocalFile, setAutoResizeLocalFile] = useState(true);
const [autoResizeLocalFile, setAutoResizeLocalFile] = useState(false);

const dispatch = useDispatch();

Expand Down Expand Up @@ -289,9 +289,10 @@ const SyntheticImageDetection = () => {
* @returns {Promise<void>}
*/
const handleSubmit = async (url) => {
const processedFile = autoResizeLocalFile
? await resizeImageWithWorker(imageFile)
: imageFile;
const processedFile =
autoResizeLocalFile && imageFile
? await resizeImageWithWorker(imageFile)
: imageFile;

if (autoResizeLocalFile && processedFile) {
setImageFile(processedFile);
Expand Down Expand Up @@ -413,8 +414,9 @@ const SyntheticImageDetection = () => {
/>
</form>

{role.includes(ROLES.EXTRA_FEATURE) ||
(role.includes(ROLES.EVALUATION) && (
{(role.includes(ROLES.EXTRA_FEATURE) ||
role.includes(ROLES.EVALUATION)) &&
imageFile && (
<FormGroup>
<FormControlLabel
control={
Expand All @@ -428,7 +430,7 @@ const SyntheticImageDetection = () => {
label="Auto-Resize"
/>
</FormGroup>
))}
)}

{isLoading && (
<Box mt={3}>
Expand Down

0 comments on commit c78cf42

Please sign in to comment.