c# - ImageResizer error -
i'm using image resizer imageresizing.net. but, when i'm trying upload or resize image, error occurs:
the source stream @ end (have read it?). must call stream.seek(0, seekorigin.begin); before re-using stream, or use imagejob resetsourcestream=true first time stream read.
using (stream newfile = system.io.file.create(path.combine(_pathresolver.resolvepath(_appsettings.companylogosdirectory), newfilename)) ) { //newfile.seek(0, seekorigin.begin); imageresizer.imagejob = new imagejob(); //i.resetsourcestream = true; = new imageresizer.imagejob(logo.inputstream, newfile, new imageresizer.resizesettings("width=120;height=45;format=jpg;mode=max")); i.createparentdirectory = false; //auto-create uploads directory. i.build(); }
you have used logo.inputstream
before provided code (maybe other job). can read image again or exception suggested put below code before using
statement:
logo.inputstream.seek(0, seekorigin.begin);
Comments
Post a Comment