Page 1 of 1

The image can't be show

Posted: 21 May 2020, 10:15
by linker
HI, I install the file app,but there is something wrong.
Snipaste_2020-05-21_22-11-54.png
install the GD and mbstring
Snipaste_2020-05-21_22-11-54.png (20.04 KiB) Viewed 3583 times
Snipaste_2020-05-21_22-14-30.png
can't see the image
Snipaste_2020-05-21_22-14-30.png (43.2 KiB) Viewed 3583 times
I don't know why,so I need your help. thanks

Re: The image can't be show

Posted: 21 May 2020, 21:24
by mjau-mjau
There is supposed to be files inside the /test/ folder? Does it show any files for ANY of the folders? Or is it always empty? I can't really diagnose from a screenshot, but looks like an error when loading the data for the folder.  You can open browser developer tools > network inspector, and then click the in Files app menu and see what loads in network inspector. Then you can click the loaded items, and see if there are any errors.

If you have a link, I can check. If not, I can only guess, because I can't see what's wrong from your screenshots.

Re: The image can't be show

Posted: 22 May 2020, 00:12
by linker
mjau-mjau wrote: There is supposed to be files inside the /test/ folder? Does it show any files for ANY of the folders? Or is it always empty? I can't really diagnose from a screenshot, but looks like an error when loading the data for the folder.  You can open browser developer tools > network inspector, and then click the in Files app menu and see what loads in network inspector. Then you can click the loaded items, and see if there are any errors.

If you have a link, I can check. If not, I can only guess, because I can't see what's wrong from your screenshots.
http://52.74.97.114/     the folder have some image in it and it can't be show. 

Re: The image can't be show

Posted: 22 May 2020, 00:37
by mjau-mjau
Your PHP is missing functionality to detect the MIME type of files. Files app needs to know the mime-type of a file to know what to do with it ... Is it text? image? video? Mime type for a JPG image should return "image/jpeg" for example. We can't rely on the file extensions, as that is insecure and not always correct.
Image

We use the below PHP function to get the mime-type of a file. It looks like you don't have mime_content_type() or finfo_file() functions available. At least one of them is required. They should be standard.
Code
function get_mime($path){
  if(function_exists('mime_content_type')){
    return mime_content_type($path);
  } else {
    return function_exists('finfo_file') ? @finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path) : false;
  }
}

Re: The image can't be show

Posted: 22 May 2020, 04:49
by linker
Thanks for your help, it is ok now. it is so coooool.

Re: The image can't be show

Posted: 26 Aug 2020, 04:46
by mjau-mjau
Since Files app release 0.2, file mime type will get detected automatically from file extension.
mjau-mjau wrote:Extensive mime type mapping
Mime type is used to detect the type of file (image, video, text etc) so that Files app knows what to do with it. Instead of extracting on server (PHP), file mime-type is now mapped from file extension, which is much faster. We use an extensive list of file extensions correctly mapped to mime type, which solves issues with misconfigured servers returning incorrect or missing mime types. New option get_mime_type (disabled by default) will force server (PHP) to extract file mime types. This is slower, but more accurate if your files have extensions that don't match the actual file type.