Skip to content
Snippets Groups Projects
Commit 25268bf7 authored by Jose Manuel Serrano Amaut's avatar Jose Manuel Serrano Amaut
Browse files

Update url image

parent 8bab05ae
No related branches found
No related tags found
No related merge requests found
...@@ -117,13 +117,13 @@ const files: ExtFile[] = [ ...@@ -117,13 +117,13 @@ const files: ExtFile[] = [
}, },
{ {
id: 1, id: 1,
name: "myself.jpg", name: "ironman.png",
type: "image/jpeg", type: "image/png",
size: 282000, size: 282000,
downloadUrl: downloadUrl:
"https://files-ui-temp-storage.s3.amazonaws.com/2878b8d4278795cef1b66b86e687d984019742a05883f58809678df4e5a80c8f.jpg", "https://i.pinimg.com/236x/3e/e9/46/3ee946b27fd1cc5eb0b485e4a0669534.jpg",
imageUrl: imageUrl:
"https://files-ui-temp-storage.s3.amazonaws.com/2878b8d4278795cef1b66b86e687d984019742a05883f58809678df4e5a80c8f.jpg", "https://i.pinimg.com/236x/3e/e9/46/3ee946b27fd1cc5eb0b485e4a0669534.jpg",
}, },
]; ];
...@@ -33,7 +33,7 @@ export default function AdvancedDropzoneDemo() { ...@@ -33,7 +33,7 @@ export default function AdvancedDropzoneDemo() {
async function checkFiles() { async function checkFiles() {
try { try {
const res = await axios.get( const res = await axios.get(
REMOTE + LOCAL +
"/file" "/file"
); );
console.log("checkFiles", res); console.log("checkFiles", res);
...@@ -55,7 +55,7 @@ export default function AdvancedDropzoneDemo() { ...@@ -55,7 +55,7 @@ export default function AdvancedDropzoneDemo() {
uploadConfig={{ uploadConfig={{
/* autoUpload: true */ /* autoUpload: true */
method: "POST", method: "POST",
url: REMOTE + "/file/28048465460", url: LOCAL + "/file/28048465460",
//url: "http://localhost:2800/file/28048465460", //url: "http://localhost:2800/file/28048465460",
cleanOnUpload: true, cleanOnUpload: true,
}} }}
......
...@@ -29,14 +29,14 @@ const FileMosaicImageLayer: React.FC<FileMosaicImageLayerProps> = ( ...@@ -29,14 +29,14 @@ const FileMosaicImageLayer: React.FC<FileMosaicImageLayerProps> = (
//console.log("FileMosaicImageLayer", props); //console.log("FileMosaicImageLayer", props);
const { imageSource, url, fileName, card, isBlur } = props; const { imageSource, url, fileName, card, isBlur } = props;
const [localSource, setSource] = React.useState<string | undefined>( const [localSource, setLocalSource] = React.useState<string | undefined>(
undefined undefined
); );
const [error, setError] = React.useState<boolean>(false); const [error, setError] = React.useState<boolean>(false);
//assign to localSource the imageSource or the url of the ile type //assign to localSource the imageSource or the url of the ile type
React.useEffect(() => { React.useEffect(() => {
setSource(imageSource || url); setLocalSource(imageSource || url);
}, [imageSource, url]); }, [imageSource, url]);
/** /**
...@@ -45,7 +45,8 @@ const FileMosaicImageLayer: React.FC<FileMosaicImageLayerProps> = ( ...@@ -45,7 +45,8 @@ const FileMosaicImageLayer: React.FC<FileMosaicImageLayerProps> = (
*/ */
const handleError = () => { const handleError = () => {
setError(true); setError(true);
setSource(url); setLocalSource(url);
console.log("FileMosaicImageLayer error", url);
}; };
//If blur is true //If blur is true
......
...@@ -62,6 +62,10 @@ const ImagePreview: React.FC<ImagePreviewProps> = ( ...@@ -62,6 +62,10 @@ const ImagePreview: React.FC<ImagePreviewProps> = (
const finalHeight: string | number | undefined = const finalHeight: string | number | undefined =
height || (orientation === "portrait" ? "100%" : undefined); height || (orientation === "portrait" ? "100%" : undefined);
const handleError=(evt: React.SyntheticEvent<HTMLImageElement, Event>)=>{
console.log("handleError", onError);
onError?.(evt);
}
return ( return (
<React.Fragment> <React.Fragment>
{src && source && ( {src && source && (
...@@ -75,7 +79,7 @@ const ImagePreview: React.FC<ImagePreviewProps> = ( ...@@ -75,7 +79,7 @@ const ImagePreview: React.FC<ImagePreviewProps> = (
src={source} src={source}
alt={alt} alt={alt}
className={className} className={className}
onError={onError} onError={handleError}
/> />
)} )}
</React.Fragment> </React.Fragment>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment