473,385 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Image control

Hi,
i'm writing a pice of code to fill the image control (in asp.net page)
with a image uploaded on the server.
The way I used is this:
protected void cmdUpload_Click(object sender, EventArgs e)
{
thumbUpload.SaveAs(Server.MapPath("/public/news/_tmp_news.jpg"));
System.Drawing.Image largeImg =
System.Drawing.Image.FromFile(Server.MapPath("/public/news/_tmp_news.jpg"));
System.Drawing.Image thumbImg =
largeImg.GetThumbnailImage(120, 120, null, IntPtr.Zero);
largeImg.Dispose();

thumbImg.Save(Server.MapPath("/public/news/_tmp_news.jpg")); //Resave
the thumb
thumbImg.Dispose();
imgThumb.ImageUrl = "/public/news/_tmp_news.jpg";

....................

Why when i try to upload again a new image the images don't change?

The image control always show the first image i uploaded, (in cache?)

DUNNO!
Jun 19 '06 #1
2 1181
thats because the browser caches images. the easiest fix is decorate the
url:

myimage.jpg?i=<random number>

-- bruce (sqlwork.com)

<luci> wrote in message
news:44***********************@reader3.news.tin.it ...
Hi,
i'm writing a pice of code to fill the image control (in asp.net page)
with a image uploaded on the server.
The way I used is this:
protected void cmdUpload_Click(object sender, EventArgs e)
{
thumbUpload.SaveAs(Server.MapPath("/public/news/_tmp_news.jpg"));
System.Drawing.Image largeImg =
System.Drawing.Image.FromFile(Server.MapPath("/public/news/_tmp_news.jpg"));
System.Drawing.Image thumbImg =
largeImg.GetThumbnailImage(120, 120, null, IntPtr.Zero);
largeImg.Dispose();

thumbImg.Save(Server.MapPath("/public/news/_tmp_news.jpg")); //Resave the
thumb
thumbImg.Dispose();
imgThumb.ImageUrl = "/public/news/_tmp_news.jpg";

...................

Why when i try to upload again a new image the images don't change?

The image control always show the first image i uploaded, (in cache?)

DUNNO!

Jun 19 '06 #2
bruce barker (sqlwork.com) ha scritto:
thats because the browser caches images. the easiest fix is decorate the
url:

myimage.jpg?i=<random number>

-- bruce (sqlwork.com)

<luci> wrote in message
news:44***********************@reader3.news.tin.it ...
Hi,
i'm writing a pice of code to fill the image control (in asp.net page)
with a image uploaded on the server.
The way I used is this:
protected void cmdUpload_Click(object sender, EventArgs e)
{
thumbUpload.SaveAs(Server.MapPath("/public/news/_tmp_news.jpg"));
System.Drawing.Image largeImg =
System.Drawing.Image.FromFile(Server.MapPath("/public/news/_tmp_news.jpg"));
System.Drawing.Image thumbImg =
largeImg.GetThumbnailImage(120, 120, null, IntPtr.Zero);
largeImg.Dispose();

thumbImg.Save(Server.MapPath("/public/news/_tmp_news.jpg")); //Resave the
thumb
thumbImg.Dispose();
imgThumb.ImageUrl = "/public/news/_tmp_news.jpg";

...................

Why when i try to upload again a new image the images don't change?

The image control always show the first image i uploaded, (in cache?)

DUNNO!


I Supposed!
There's a method to clear the cache? just to know!
Jun 20 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Greg Christie | last post by:
I think I have a somewhat unique situation here, so I thought I should post it for the few poor souls who run across it and try to google it like I did. First of all, I was getting the following...
4
by: Ed Landau | last post by:
In VB6.0, I can put an image on a form and assign it's .picture property at run-time. In VBA (within MS Access), when I put down an image control on a form, it asks me for the source to the image...
4
by: Kevin Myers | last post by:
Hello, Please forgive my reposting of this note with hopefully a more relevant subject line. On an Access 2000 form under Windows 2000 I would like to use a Kodak Image Edit Control to...
12
by: Sharon | last post by:
I’m wrote a small DLL that used the FreeImage.DLL (that can be found at http://www.codeproject.com/bitmap/graphicsuite.asp). I also wrote a small console application in C++ (unmanaged) that uses...
0
by: Satish Appasani | last post by:
Hi: I have a ASP.NET form with Web layout which I've achieved using panels. In one of the tab I have a File control to upload Images. When I put a file in the file control and move to another...
10
by: David W. Simmonds | last post by:
I have a DataList control that has an Image control in the ItemTemplate. I would like to resize the image that goes into that control. I have a series of jpg files that are full size, full...
1
by: Brian | last post by:
Using A2K I have an image control on a report and use code to set the image.picture to the required jpg. 3 of the jpgs resize properly but 2 do not - they display much smaller than the image...
3
by: Raghu Raman | last post by:
Hi i want to save the read the image file and show it on a image control of a mobile webform .But the mobile control does not support html images ,so i am forced to use the server image control...
9
by: Mark Denardo | last post by:
This is related to another post I submitted, but I'll be more precise this time. I have a web page that contains an Image webcontrol that loads its image by: Image1.ImageUrl="<username>.jpg",...
0
by: SayamiSuchi | last post by:
hi I have taken one image control("image1") in the form("frmForm1.aspx").Now i want to one image ("mypic.jpeg") whose size is larger than the image control i.e image1.When i run the program, the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.