Page 1 of 2

URL of image

Posted: Mon Jan 04, 2010 3:46 am
by Raul2
Hi from Spain,

I have this url, http://localhost/?id=266&doc=90630&tipo=i, for URL property in a image, but dont show anything at designer or rendered, but if I copy and paste this url in Internet Explorer, it show me the image, open it, no download.
Does designer needs the clean url to image file?

The version is 2009.3

Thanks, regards.

URL of image

Posted: Mon Jan 04, 2010 11:30 am
by Jan
Hello Raul,

We use following code to load image from url:

Code: Select all

using System;
using System.Net;
using System.Drawing;
using System.Drawing.Imaging;
using System.ComponentModel;
using System.IO;

public static Image LoadBitmap(string url)
{
	WebClient cl = new WebClient();
	cl.Credentials = CredentialCache.DefaultCredentials;
	byte [] bytes = cl.DownloadData(url);
        cl.Dispose();

	MemoryStream stream = new MemoryStream(bytes);
        return new Bitmap(stream);
}
Try to load your image with help of this method.

Thank you.

URL of image

Posted: Tue Jan 05, 2010 4:35 am
by Raul2
Hi Jan, thanks for your response.

With the url http://localhost/?id=266&doc=90630&tipo=i as parameter for this method I get a error of "The parameter is not valid." when render. I use this:

Code: Select all

Image2.Image = LoadBitmap("http://localhost/?id=266&doc=90630&tipo=i")

URL of image

Posted: Tue Jan 05, 2010 8:11 am
by Edward
Hi Raúl,

In that case please use absolute or relative URLs for images. Nice example of that:

http://www.aspdotnetfaq.com/Faq/how-to- ... -page.aspx
http://msdn.microsoft.com/en-us/library/ms178116.aspx

Thank you.

URL of image

Posted: Mon Jan 11, 2010 6:41 am
by Raul2

Thanks for the info.

URL of image

Posted: Thu Mar 11, 2010 11:47 am
by Raul2
and could be possible something like this?:

Code: Select all

Me.Image1.File = "C:\Images\" + {FILES.FILE_NAME}
or 
Me.Image1.File = "C:\Images\" + {FILES.FILE_NAME} + ".jpg"

URL of image

Posted: Thu Mar 11, 2010 5:37 pm
by Edward
Hi,

Yes, that is possible:

string p = "C:\\Images\\" + FILES.FILE_NAME.ToString()+".jpg";

im.Image = Image.FromFile(p);

Thank you.

URL of image

Posted: Fri Mar 12, 2010 6:59 am
by Raul2
Now I am trying to show some images in a data element with 2 columns. The name of the image files is stored in a field of a table, looking this thread (http://forum.stimulsoft.com/default.aspx?g=posts&t=2857) I try to put in the "Image Data" of the Image1 located in first column in the data element this code:

Code: Select all

{Image.FromFile("C:\Images\" + FILES.FILE_NAME.ToString() + ".jpg"}
but i get error because in the code I have this:

Code: Select all

Public Sub Image1__GetImageData(ByVal sender As Object, ByVal e As Stimulsoft.Report.Events.StiGetImageDataEventArgs)
            e.Value = "{Image.FromFile(""C:\Images\"" + FILES.FILE_NAME.ToString() + "".jpg""}"
End Sub
How I must write it in "Image Data"?

Thanks and sorry for my bad English.

URL of image

Posted: Fri Mar 12, 2010 8:12 am
by Jan
Hello,

Please check following:

Code: Select all

Image.FromFile("C:\Images\" + FILES.FILE_NAME.ToString() + ".jpg"
Thank you.

URL of image

Posted: Mon Mar 15, 2010 5:46 am
by Raul2
I get this now:

Code: Select all

Public Sub Image1__GetImageData(ByVal sender As Object, ByVal e As Stimulsoft.Report.Events.StiGetImageDataEventArgs)
            e.Value = "Image.FromFile(""C:\Images\"" + FILES.FILE_NAME.ToString() + "".jpg"""
End Sub
but I have solved it saving the entire path in the field:

Code: Select all

{Image.FromFile(FILES.ENTIRE_PATH)}
Thanks for help me.