473,382 Members | 1,786 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,382 software developers and data experts.

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 1740
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*******@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.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*******@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.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
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...
3
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() //...
7
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...
2
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...
1
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...
3
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...
3
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...
4
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...
6
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....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...

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.