473,809 Members | 2,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Replace blank images with default image

13 New Member
In my program I am storing images in the database. Not all of the records in the database have images, and when I load the details into another .aspx page, sometimes the image is empty- has a red "x". How do I replace that "x" with a default image?
Apr 14 '09
12 12558
Bassem
344 Contributor
I didn't get the code-problem so let me suggest another way to solve it.
It's not a perfect one but until you find the problem.
You may pass intImageSize as a parameter to myCommand and make your test for the NULL value in Sql as this :
Expand|Select|Wrap|Line Numbers
  1. @intImageSize   int
  2.      if(@intImageSize = 0)
  3.           @picture = null
  4.  -- then the rest of your query ...
If it works so the problem was in passing the null value. If not make sure that you didn't set a default value for picture column. If you did remove it, It've to be null.

Actually I don't store images in database, I save images as files each has an identical name, by using an index for example, and storing only the path. Think about it, if the problem still annoying.

Thanks,
Bassem
Apr 17 '09 #11
amandab116
13 New Member
I've solved the problem by implemeting the code like you've suggested :)

Now I've run into the dilemma of trying to solve the issue of overwriting already supplied images.

If the upload box is left blank, it still updates the database as a null... overwriting anything that was already stored.

As you can see, this is my first time using images in my database. I can't store the filepath because this is a program allowing users to create new resources and upload a picture from their machine and it needs to be stored in the database itself, not just the filepath.
Apr 17 '09 #12
Bassem
344 Contributor
You're inserting records, I see no updating?!
What's the primary key in this table and which columns are unique?
How do you checked that the date is overwritten? or how do you make the select query?

About storing paths of images,
You can save the image on a server directory and store paths refer to these images on server.

>> data not date <<
Apr 17 '09 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1907
by: Trent | last post by:
Hey All, I am new to javascript and currently coding a site with scripts that are beyond my level of understanding. The problematic page has thumbnail images that can be clicked on to zoom in. When clicked, the preloaded larger image displays in a div layer that gets turned on. The problem is that ie sometimes does not display the image - the placeholder just stays blank. The script works fine in firefox and netscape (haven't tried...
15
6226
by: Jake | last post by:
Not sure if this can be done with javascript but I would like to find a way to detect if an image is missing and replace it with a default image instead of the dreaded RED X showing up. So - Is Javascript the way? Or should I look elesewhere? Thanks in Advance!
4
4624
by: Saya | last post by:
Hello, The IIS default location for images, usually is 'Inetpub/wwwroot/images'; currently I'm using: 'picWeb.Image=GetImage(IMG_URL+filename)', where IMG_URL="http://ipadress/images", to reach my images in my web service application. Is there a command available to get the images from a different location in the server machine, for example at another logical drive?
1
1344
by: KitKat | last post by:
With the help of kind, brilliant folks, I have been working on this program that uses a combo box selection to display six different jpgs. The jps are a time stamp, and the files are located in six different folders of camera views. HOWEVER, some of these folders do not have that certain timed jpg. So...I need to figure out how to show all the rest of the pictures and use an "no image available or something" for the program to work...
2
1603
by: sanju | last post by:
Hi, I am struggling to replace a bit value 'True' or 'False' with a image true.gif or false.gif and bind it to a repeater control. I am getting values 'true' or 'false' depending on whether user is logged in or not(with asp.net membership provider) Getting true or false with this <%# Membership.GetUser(Eval("UserID")).IsOnline % and
1
6319
by: wkerplunk | last post by:
On mouseover it goes to the correct map say TheMap1.jpg and then on mouseOut it defaults back to map, I need to do a onClick that sets the TheMap1.jpg mouseOver to the default TheMap.jpg so the TheMap1.jpg is now the default image not the TheMap.jpg. So after I click for information, and mouseOut of that area TheMap1.jpg will stay as all the MouseOuts Until I click another area of the map say TheMap10.jpg once clicked TheMap10.jpg will become...
3
7923
by: Paul Cheetham | last post by:
Hi, I have an application that will display user-defined images in some asp:image controls. (sets the ImageURL, and is always built from the site root) The problem comes when the images specified do not exist, as it displays a red cross and the alternate text. What I would like to do is display a default image instead.
2
3346
by: aris1234 | last post by:
Can you use PHP to show a default image if the image field in a database row is empty? I'm creating a news page, but the client may not always upload an image with a news story. I know how to hide the area, but this leaves a big blank space. It would be much better if a default image were to appear.
2
3022
by: Simon Wigzell | last post by:
I have inherited a database driven website that comes with a table of image links. The images are scattered all of the internet and there are thousands of them. I would like to write an asp script to just run through the table and download every link by it's URL. I thought I had id by faking a form with the "File" element and loading it with all the URLs. Would have worked except you cannot preload the "File" element. As I understand it,...
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9601
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10115
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9198
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7653
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3013
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.