load a image from file
Hi
i??m tryng the .net and i don??t finde way to load a image since i have a database containing the name but in the server i have many folders how can i looad 0002.jpeg to my picture1
load a image from www\upload_image\1002.jpeg to my picture1
Thank you
i??m tryng the .net and i don??t finde way to load a image since i have a database containing the name but in the server i have many folders how can i looad 0002.jpeg to my picture1
load a image from www\upload_image\1002.jpeg to my picture1
Thank you
Comments
Version 2017.1
[Core]
+ added possibility to set picture location (URL) in PictureObject from database (I have not try this version)
+ .....
if you use old the version of fastreport, you may use script in frx file.
in your asp.net code, the imagecolumn is referring to full path location of your images in the server, for example :
HttpContext.Current.Server.MapPath("~/upload_image/") + "1001.jpeg"
HttpContext.Current.Server.MapPath("~/upload_image/") + "1002.jpeg"
....
Is it possible in the script to dinamic load from the database field ?
HttpContext.Current.Server.MapPath("~/upload_image/")
private void Data1_BeforePrint(object sender, EventArgs e)
{
+clienten/+ fotoN
Thanks again for the help
if you want to do that in script, you must set a reference to use server.mappath function, never tried before.
I will use this scenario :
1. i have a datatable with fields :
* ID int = 1
* Name string = MyName
* Picture string = 001.jpeg
2. modify field Picture with full path location
foreach (row in rows)
{
string img = row.Picture.ToString();
row.Picture = HttpContext.Current.Server.MapPath("~/upload_image/") + img;
}
3. push datatable to fastreport
4. use script to attach column picture to PictureObject
please inform in this forum if you have succeded with using server.mappath in the script. and about the performance speed.
1. add referenced assemblies in fastreport designer, menu report => options => script => add =>
in my case, x86 system, C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.dll
2. script
3. maybe, easier method, just passing HttpContext.Current.Server.MapPath("~/Content/") as report parameter, no need to set reference in the script, just Picture1.ImageLocation = (String)Report.GetParameterValue("ImageFullPath");