Skip to main content

Report Help: Display image from server location

Comments

3 comments

  • Permanently deleted user

    Hi Daniel,

       You want an image control instead of a rich textbox to show an image.

    Here is the script in the RPX file found in the code gallery at https://support.geocortex.com/la-county-parcel-report

    public void detail_Format()

     

    {

     

     try {

     

     

     

     string imageUrl = String.Format("http://maps.googleapis.com/maps/api/streetview?size=400x400&location={0} {1}&sensor=false"

     

              , rpt.Fields["SITEADDRESS"].Value.ToString()

     

              , rpt.Fields["SA_CITYSTATE"].Value.ToString() );

     

     

     

     System.Net.WebClient client = new System.Net.WebClient();

     

     System.IO.Stream stream = client.OpenRead(imageUrl);

     

     System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(stream);

     

     stream.Flush();

     

     stream.Close();

     

     

     

     Picture streetView = (Picture)rpt.Sections["detail"].Controls["StreetView"];

     

     streetView.Image = (Image)bitmap;

     } catch {}

     

    }

    In the 4.2 LA County sample site, the example changed to use a transformation workflow. Watch http://support.geocortex.com/report-dataset-transformation-workflows to get started with this method.

    regards,

     

    Edmond 

     

    0
  • Permanently deleted user

    Edmond

     Thank for the reply. What I found out was that my code was fine. I moved it from the Details_Format() event into the Details_BeforePrint() event and it worked perfectly.  My guess is that the report was redering before the script could retrieve the image.??  Just thought I would post an update. Thanks again.

     

    Dan 

    0
  • Permanently deleted user
    Daniel,

     

    Thank you for posting your code example.  I was able to get it to work for our setup.  However, I'm trying to handle a 1-to-many relationship, with the report capable of handling multiple images, and I've not been able to adapt the code in a sub report to dynamically update a new picture (it duplicates the first picture)...Any thoughts?

     

    Faron
    0

Please sign in to leave a comment.