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

The scrips shows preview for all files even not image files in Show previous uploads feature. #168

Open
PhpMax opened this issue Oct 6, 2017 · 4 comments

Comments

@PhpMax
Copy link

PhpMax commented Oct 6, 2017

Hello,

When using Show previous uploads feature
snapshot
with showPreview:true, the scrips shows preview for all files even not image files.

@hayageek
Copy link
Owner

hayageek commented Oct 6, 2017

which browser ?

@PhpMax
Copy link
Author

PhpMax commented Oct 6, 2017

I tested it on Chrome Version 61.0.3163.100 (Official Build) (64-bit)
and on Firefox 56.0 (64-bit)
same thing

@PhpMax
Copy link
Author

PhpMax commented Oct 12, 2017

Here is the solution I made to solve the problem:

upload page

onLoad:function(obj)
   {
   	$.ajax({
	    	cache: false,
		    url: "load.php",
	    	dataType: "json",
		    success: function(data) 
		    {
			    for(var i=0;i<data.length;i++)
   	    	{ 
       			obj.createProgress(data[i]["name"],data[i]["path"],data[i]["size"],data[i]["image"]);
       		}
	        }
		});
  },

load.php

add

if (getimagesize($filePath)) {$details['image']=1;}

jquery.uploadfile.js

        //This is for showing Old files to user.
        this.createProgress = function (filename,filepath,filesize,image) {
            var pd = new createProgressDiv(this, s);
            pd.progressDiv.show();
            pd.progressbar.width('100%');

            var fileNameStr = "";
            if(s.showFileCounter)
            	fileNameStr = obj.fileCounter + s.fileCounterStyle + filename;
            else fileNameStr = filename;


            if(s.showFileSize)
				fileNameStr += " ("+getSizeStr(filesize)+")";


            pd.filename.html(fileNameStr);
            obj.fileCounter++;
            obj.selectedFiles++;
            if(s.showPreview && image)
            {
                pd.preview.attr('src',filepath);
                pd.preview.show();
            }

@hayageek
Copy link
Owner

Thank you. I will fix it.

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

2 participants