Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Dynamic Image Change does't work without reload!

Posted on 2007-11-14
3
Medium Priority
?
1,874 Views
Last Modified: 2013-11-19
Hello,
I have an HTML page. On that page there exists a button which opens a pop-up window. In the pop-up window, users can upload images.

When the upload operation finishes, the pop-up window set's the src, width and height property of an image tag in the opener HTML page and the pop-up window is closed automatically. The uploaded image is shown on the opener HTML page, without refreshing it.

The problem is this: When you upload first image, everthing is Okay.. But while adding more images, the previously added image that is showm on the main HTML page doesn't get changed.. This happen usually, not all the time..

For instance, when you first upload a image which has a width 300, and after that upload an image which has a width 100, the pop up window can succesfully change the width to 100 and the exisiting image gets narrowed, but new image is not shown..

When you refreh the page, everything is fixed and new image is shown..

There is no problem with uploading image or setting the src property of image.. It looks like there is a caching problem of images.. But how to fix this?

Does anyboy has an idea about this issue, or anyone who faced and fixed smilar problems?

Thank you all..
0
Comment
Question by:uluburak
  • 2
3 Comments
 
LVL 12

Expert Comment

by:UnexplainedWays
ID: 20278928
You can play with the caching of the image, however the quickest and easiest solution is to just wack the date + time on the end of the url.
0
 
LVL 12

Accepted Solution

by:
UnexplainedWays earned 1600 total points
ID: 20278942
I assume your using javascript since it's clientside.

So here's a quick example

Just replace the textbox with the image src.

<script>

      function Something()
      {
            document.getElementById("theImage").value = "img.jpg?seed="+new Date();
      }

</script>
<input type=text id="theImage" style="width:400" /><input type=button onclick="Something()" value="Do it"/>

0
 
LVL 15

Assisted Solution

by:VincentPuglia
VincentPuglia earned 400 total points
ID: 20282437
Hi,
What does your code look like (popUp & opener)?  Is the opener's image tn a div?  In other words, are you dong anything like:

opener.document.getElementById('imgDiv').innerHTML = "<img .....>"

if not, give it a try.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question