Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InitialPreview icon / File content thumbnail. #809

Closed
dams0142 opened this issue Nov 30, 2016 · 10 comments
Closed

InitialPreview icon / File content thumbnail. #809

dams0142 opened this issue Nov 30, 2016 · 10 comments

Comments

@dams0142
Copy link

Hey kartik,

First of all, thank you for this awesome tool. I have been playing with it for the last 3 months and it's surprising how you can do almost whatever you want.

It's not an issue as everything works as expected, but i've been struggling to find informations about what i wanna do, hopefully you will help me :)

I'm using initialPreview to populate the plugin with Pdf files, and i allow end users to add more pdf files (or remove some..). The big view when you click the magnifying glass button is really useful and i want this behavior to remain the same, but i would like to know if it's possible to display the Pdf icon instead of the shrinked file content (thumbnail). The user would see the pdf icon in the widget (with caption, size, ...) and he would have to click the mgnifying glass button to actually see the file content.

It's a bit weird for the user to see a Pdf content in the thumbnail and to be unable to read it.

I'm afraid this can't be done because the thumbnail seems to be a shrinked version of the preview, and not another container, but even so, a confirmation would be great.

Thank you :)

Damien.

@emilas44
Copy link

emilas44 commented Dec 6, 2016

I think this is exactly my issue also....
http://stackoverflow.com/questions/40998287/krajee-bootstrap-file-upload-plugin-previewfileiconsettings

we need help!!!

@kartik-v
Copy link
Owner

kartik-v commented Dec 7, 2016

@dams0142 thanks for the feedback - the plugin is intended to be configurable and can be styled as per your needs (and maybe render it as a file explorer user interface as well if needed).

On your query, currently the markup/content in the initial preview thumbnail is first rendered. The same content is directly used to render the content in the ZOOMED preview as well (with intelligent styling to show a magnified version of it and expand full screen).

It would need to be coded entirely differently if you want to show a different content in thumbnail and zoomed preview. Will need to check on this impact and see if there is anything simpler.

@emilas44 your issue is different... could you share a JS fiddle to see your configuration and understand the issue?

@kartik-v
Copy link
Owner

kartik-v commented Dec 7, 2016

@dams0142 I think I can include a configuration to override and display preview icon only in thumbnail but show different content in the zoomed preview. But this may take a bit of time.

@emilas44
Copy link

emilas44 commented Dec 7, 2016

It's simple like in my question on SO http://stackoverflow.com/questions/40998287/krajee-bootstrap-file-upload-plugin-previewfileiconsettings

I am using the form upload method - no ajax. And when i choose the files the icons are shown for each file type and for images i get the preview....but when i go to edit view i load those files from my folder and images have preview but all other files are shown like there is no image (see on Stack overflow question) and that is true that there is no image but why it doesn't load the icon for that file type?

@kartik-v
Copy link
Owner

kartik-v commented Dec 7, 2016

For edit page, you need to configure initialPreview to display the markup to be shown in initial preview:

$('#input-id').fileinput({
    initialPreview: [
        '<i class="fa fa-file-word-o text-primary"></i>',  // icon for file 1
        '<i class="fa fa-file-excel-o text-success"></i>',  // icon for file 2
    ],
    initialPreviewAsData: false
});

The plugin does not have a method to understand file types on the server to auto display icons based on file type.

It could be a potential enhancement to detect this based on file extension.

@emilas44
Copy link

emilas44 commented Dec 7, 2016

OK i see...that was my inquiry to recognize the file type from server and show the file icon accordingly. But i solved it other way around....this was my next question on SO: http://stackoverflow.com/questions/41013883/laravel-blade-show-fa-icon-dependable-on-file-type/41014105#41014105

I don't have an image preview but i have the icon for any file type i have uploaded

@kartik-v
Copy link
Owner

kartik-v commented Dec 7, 2016

It may include a potential enhancement to detect this based on file extension - for icons... will update.

@emilas44
Copy link

emilas44 commented Dec 7, 2016

That would be cool

@dams0142
Copy link
Author

dams0142 commented Dec 7, 2016

@kartik-v Thank you for your answers. This would be an amazing update if we could have the possibility to override the file content with an icon, in the thumbnail.
Keep up the great work !

@kartik-v
Copy link
Owner

kartik-v commented Dec 17, 2016

This is resolved via new enhancements. Check the CHANGE LOG.

The following demos will help explain this

  • To prefer/force iconic thumbnail preview and detailed zoom content check this demo
  • To prefer/force iconic preview in zoomed content and normal preview in thumbnails check this demo
  • To extend the above for initial previews - and using different previews for initial preview iconic thumbnails and yet a detailed zoomed content see this demo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants