Image from database field URL
Hello everyone.
I am having an issue here. Help me please.
Everything else is OK, but I can't display image which has URL in database field.
I mean I would like to show one or more image in report, and image URL is in database IMG_URL field.
Databinding code is here:
In report file, image object's datafield value is here [VW.img_url]
But I realise it displays only blob or clob or byte image.
How I could fix this issue.
Thanks
I am having an issue here. Help me please.
Everything else is OK, but I can't display image which has URL in database field.
I mean I would like to show one or more image in report, and image URL is in database IMG_URL field.
Databinding code is here:
string AliasName = "VW";
                    string FilePath = "../Report/M5400.frx";
                    string SQL = "SELECT * FROM asap.vw5400_print WHERE bnohistory_id = 121212";
                    DataTable dt = Services.Database.ExecuteQuery(SQL).Tables[0];
                    WebReport1.Report = new FastReport.Report();
                    WebReport1.Report.RegisterData(dt, "VW");
                    WebReport1.ReportDataSources = "VW";
                    WebReport1.ReportFile = FilePath;
In report file, image object's datafield value is here [VW.img_url]
But I realise it displays only blob or clob or byte image.
How I could fix this issue.
Thanks
Comments
I do something similar except that I call a special thumnail URL to resize the picture before placing in on the report.
Add an PictureObject on your report.
Select it.
Create a "BeforePrint" event handler.
Here is my handler. It reads the URL from a field in the report, appends some properties to the URL (to thumbnail the picture) and then changes the "ImageLocation" of the PictureObject. FastReports will go out, retrieve the picture and put it in the report. Pretty cool, huh?
private void PropertyPicture_BeforePrint(object sender, EventArgs e)
{
string URL1;
URL1=((String)Report.GetColumnValue("Query1.AptPictureURL"));
URL1+="&w="+Convert.ToInt32(PropertyPicture.Width).ToString()+"&h="+Convert.ToInt32(PropertyPicture.Height).ToString();
PropertyPicture.ImageLocation=URL1;
}
You could probably just do something like
MyPicture.ImageLocation=((String)Report.GetColumnValue("myquery.myfield"));
in your BeforePrint handler.
I think you'll find it works quite well.
Bryan
Picture1.Image = new Bitmap(new MemoryStream(here_is_your_byte[]_array));