473,583 Members | 2,875 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Validate image exists

I'm trying to write some code to validate if an image is present on the
server. If the image is missing then I want to display out noimage.gif file.

I have a website that has thousands of products with thousands of images for
those products. Here's a page with two missing images.

http://dep.teamattire.com/Store/defa...45&SubCatID=75

Many of the images come from other webservers. We do not have the images
locally. I'd like to validate the image as the data grid loads (databound
event).

Any help or guidance is greatly appreciated.

Thanks!

Nov 19 '05 #1
2 1749
Generally this is a really bad idea because this will end up being very,
very slow.

What you might do is have some other process manage a table with the image
links and check them out and write them to a database. This works for either
file or URL based links. With URLs you can use WebClient to check
availability.

You can run this in an external process or fire off a separate background
thread from your ASP.NET application that manages this table of links. You'd
always assume last state until it changes. Obviously this will mean that the
data is not necessarily real time - it'll be only as up to date as the last
link run.

Another approach is have your application manage the image display
directly - have a link or something that can be resolved to a link in your
datagrid in your table that is used for item display and only fill this
value if the image is available. You can either auto-update that using the
same approach above or manually manage the image availabilty...

+++ Rick ---

--

Rick Strahl
West Wind Technologies
www.west-wind.com
www.west-wind.com/weblog

"CDWaddell" <CD*******@disc ussions.microso ft.com> wrote in message
news:D5******** *************** ***********@mic rosoft.com...
I'm trying to write some code to validate if an image is present on the
server. If the image is missing then I want to display out noimage.gif
file.

I have a website that has thousands of products with thousands of images
for
those products. Here's a page with two missing images.

http://dep.teamattire.com/Store/defa...45&SubCatID=75

Many of the images come from other webservers. We do not have the images
locally. I'd like to validate the image as the data grid loads (databound
event).

Any help or guidance is greatly appreciated.

Thanks!

Nov 19 '05 #2
This would be ok however I get weekly datafeed that contain anywhere from
300,000 - 500,000 products each week. Granted a number of these will not
change however I have no idea which one will and which ones will not. I'm
planing on going down that route with the next site revision but will wait
until the next release of .NET comes out to do that. In the mean time I would
simply like to check for valid images.

"Rick Strahl [MVP]" wrote:
Generally this is a really bad idea because this will end up being very,
very slow.

What you might do is have some other process manage a table with the image
links and check them out and write them to a database. This works for either
file or URL based links. With URLs you can use WebClient to check
availability.

You can run this in an external process or fire off a separate background
thread from your ASP.NET application that manages this table of links. You'd
always assume last state until it changes. Obviously this will mean that the
data is not necessarily real time - it'll be only as up to date as the last
link run.

Another approach is have your application manage the image display
directly - have a link or something that can be resolved to a link in your
datagrid in your table that is used for item display and only fill this
value if the image is available. You can either auto-update that using the
same approach above or manually manage the image availabilty...

+++ Rick ---

--

Rick Strahl
West Wind Technologies
www.west-wind.com
www.west-wind.com/weblog

"CDWaddell" <CD*******@disc ussions.microso ft.com> wrote in message
news:D5******** *************** ***********@mic rosoft.com...
I'm trying to write some code to validate if an image is present on the
server. If the image is missing then I want to display out noimage.gif
file.

I have a website that has thousands of products with thousands of images
for
those products. Here's a page with two missing images.

http://dep.teamattire.com/Store/defa...45&SubCatID=75

Many of the images come from other webservers. We do not have the images
locally. I'd like to validate the image as the data grid loads (databound
event).

Any help or guidance is greatly appreciated.

Thanks!


Nov 19 '05 #3

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

Similar topics

3
11752
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a table in MySQL with the path & filename to the image. I have successfully uploaded and performed an update query on the database, but the problem...
3
9682
by: Dennis Allen | last post by:
Hi. I've been trying to write Javascript code that checking if an image exists. If it doesn't exist, I want to load a known image. I've tried: if (document.images) { var tester=new Image() // public variable tester.onload="cImg('good')" tester.onerror="cImg('bad')" tester.src="http://www.temp.com/image.jpg" }
7
1605
by: fingermark | last post by:
I'm writing an upload script and would like to know what is the safest way to validate a file type that is being uploaded to a server? I am accepting just bmp, jpg, png, and gif. Here are is what I have come accross: $_FILES - I heard this is not safe $imginfo = getimagesize($filename); - I heard this is safer
2
20668
by: Mark Kamoski | last post by:
How can one change an image url at runtime? (Note, the image exists in a user control.) This is the image tag on the ascx... <asp:image id="TopBanner" runat="server"></asp:image> ....but I cannot get this to change from the code behind of a page that hosts the user control.
1
8969
by: Ollie | last post by:
Does anyone know how to validate a UNC path? I am currently using: Directory.Exists (szUncPath) This works if the path is located on my machine. However, if the path is for another machine (on the network), this method fails. Any suggestions on how to get this to work or aternative ways to programmatically validate a UNC path would be...
3
20031
by: anastasia | last post by:
I get an out of memory exception when attempting to excecute the following code: original = System.Drawing.Image.FromFile(file.FileName,true); I ONLY get this exception when the file is in the "My Documents" folder or subfolders. If the file lives anywhere else on the hard drive, I have no problems. What could be going on here?
3
5951
by: Martin | last post by:
Hi, I am implemeting a form in asp.net. The form is quite large and the validation is reasonably complex, so I have decieded to implement my own validation rather than use any custon validators, so I have a button on the form and the "causes validation" property is set to true. I have overridden the "Validate()" like so
4
7969
by: Simon Verona | last post by:
I'm using wia in a vb.net project to capture images from a scanner.. This works fine. However, I want to control the way that images are scanned - ie B+W, Greyscale and resolution etc, but can't work out how to. My code for scanning is below (sorry it's a bit messy - it's been chopped and changed around a lot)... There seems to be very...
6
11838
by: Lorenzo Thurman | last post by:
Does anyone know how to validate a particular image type using PHP? If I have a file and I want to ensure that it is a jpeg, how would go about it? A sort of is_jpeg or is_gif is what I'm seeking. TIA
0
7811
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8159
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8314
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7922
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6571
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5689
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5366
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3811
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3836
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.