Web Forms :: How To Make One Image Load First On A Webpage Before The Other 20 Images
Jul 15, 2010
In my webpage I have 20 .jpg Images. Sometimes it can take about 10 seconds before the webpage is loaded and all images are seen.
I have one .jpg image that are more important to visually see first before the others.
So my question is if it is possible to "force" one image to load the Very first to be seen visually? I dont know if this works in a specific order or the webpage renders it by random?
I'm going to design a database for an image gallery in ASP.NET Web App . Because of some reasons I've decided to store the image in Data Base , Not the address .
In the application i need two or more different size and weight image for each image that the admin insert .For instance , One of them is small and lightweight thumbnail , and the other is Original big one .
My question is : Should i have two column ( one for lightweight and small thumbnail and one for big and full size one ) in DataBase Or Is there any way i could load different size and wight image from Big and original image column ?
i have encountered a problem on how to load the database images to be display in the Image content in the web pages. I am currently using an Access database with a table "Images" and there are 4 columns in it. "ImageID", "ImageDescription","ImageofPicture","Description". Below is my code: Words highlighted in bold is where the problem occurs. No image is display in the Image box but theres a red cross at the top left. Image description is displaying fine in the textboxes
int MaxRows = 0; int inc = 0; int inc1 = 1; int inc2 = 2; int inc3 = 3; System.Data.OleDb.OleDbConnection cs; System.Data.OleDb.OleDbDataAdapter dta; DataSet ds1; byte[] photo_array; protected void Page_Load(object sender, EventArgs e) { cs = new System.Data.OleDb.OleDbConnection(); //tell the program where the database is located cs.ConnectionString = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=C:\Users\Admin\Desktop\Website1\App_Data\Database.mdb"; ds1 = new DataSet(); string sql = "SELECT * From Images ORDER BY ImageDescription ASC"; dta = new System.Data.OleDb.OleDbDataAdapter(sql, cs); cs.Open(); dta.Fill(ds1, "Images"); Navigation(); //MaxRows equals to the total amount of records from the database MaxRows = ds1.Tables["Images"].Rows.Count; } private void Navigation() { //get the first records from the database DataRow dtaRow = ds1.Tables["Images"].Rows[inc]; //get column values in the row TextBox3.Text = dtaRow.ItemArray.GetValue(1).ToString(); TextBox7.Text = dtaRow.ItemArray.GetValue(3).ToString(); DataRow dtaRow1 = ds1.Tables["Images"].Rows[inc1]; TextBox4.Text = dtaRow1.ItemArray.GetValue(1).ToString(); TextBox2.Text = dtaRow1.ItemArray.GetValue(3).ToString(); DataRow dtaRow2 = ds1.Tables["Images"].Rows[inc2]; TextBox5.Text = dtaRow2.ItemArray.GetValue(1).ToString(); TextBox8.Text = dtaRow2.ItemArray.GetValue(3).ToString(); DataRow dtaRow3 = ds1.Tables["Images"].Rows[inc3]; TextBox6.Text = dtaRow3.ItemArray.GetValue(1).ToString(); TextBox9.Text = dtaRow3.ItemArray.GetValue(3).ToString(); //if 3rd column value is not null if (ds1.Tables[0].Rows[inc][2] != System.DBNull.Value) { Image5.ImageUrl = "ImageHandler.ashx?ImageDescription=" + TextBox3.Text; } if (ds1.Tables[0].Rows[inc1][2] != System.DBNull.Value) { Image5.ImageUrl = "ImageHandler.ashx?ImageDescription=" + TextBox4.Text; } if (ds1.Tables[0].Rows[inc2][2] != System.DBNull.Value) { Image5.ImageUrl = "ImageHandler.ashx?ImageDescription=" + TextBox5.Text; } if (ds1.Tables[0].Rows[inc3][2] != System.DBNull.Value) { Image5.ImageUrl = "ImageHandler.ashx?ImageDescription=" + TextBox6.Text; } } } Code for ImageHandler.ashx: using System; using System.Web; using System.Data.OleDb; public class ImageHandler : IHttpHandler { public void ProcessRequest (HttpContext context) { string qry = "SELECT ImageofPicture FROM Images WHERE ImageDescription = ?"; string connect = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=C:\Users\Admin\Desktop\Website1\App_Data\Database.mdb"; using (OleDbConnection conn = new OleDbConnection(connect)) { if (context.Request.QueryString["id"] != null) { OleDbCommand cmd = new OleDbCommand(qry, conn); cmd.Parameters.AddWithValue("", context.Request.QueryString["id"]); conn.Open(); using (OleDbDataReader rdr = cmd.ExecuteReader()) { if (rdr.HasRows) { rdr.Read(); context.Response.ContentType = "image/jpeg"; context.Response.BinaryWrite((byte[])rdr["ImageofPicture"]); } } } } } public bool IsReusable { get { return false; }
we are creating a custom content management and out portal page is bit bulky it is about 60Kb without images.
and during loading the page in some browser we can see some parts of site load faster than the other parts of the site where as we want to indicate (or instruct the web server) to load some of the areas first then load rest of the page.
is there any particular setting in IIS for is there any particular method in classic asp for doing that? also I have the same question in asp.net.
I've got a problem with showing images on a page, that i hope someone might help with.
I have two sites like this;
C:WebsitesWebsite - Main Site
C:WebsitesAdmin - Admin site for main site
There is a table in the database that has a link to an image in a folder like this;
C:WebsitesImages - image store
The problem i am having is that when i view the page, the images don't show up. But if connect to the images folder using Windows Explorer then view the page again the images are visible.
Is there a way to have an image store and then all images be availabe to both sites?
I have though about the possibility of using a structure like this; (but i'd rather not)
I have a folder at my server as Images consists of 200 images. My aim is to show those images in my webpage. What ever my be the control no problem like(gridview,.....) How to retrieve those images. *It should be dynamically generated. In future the count of images may increase. Better to have paging. If possible when i click on single image it should give a popup to show that image in large size.
In my application, in a single page i need to display small images(say some 10, i.e category wise) and if the user selects any one image then it needs to be maximized (like photo album). How I need to do this. Pls any Idea. maximized image will be displayed in the same page or another new page?
i have started to do a Asp.net Website Project...Am given few Images , to place it according to the requirement Web Page Sample image given by the client....Am just wondering how to calculatethe exact dimensions of the various parts of a page for Placing Images Perfectly.
Am using Html Divs , Css and a tool called WebPage Maker..Using WebPageMaker Tool i can place images and by running on a browser ,i can calculate the dimensions of that particular part[ For Ex:Header Image] by using FireBug Tool.....
But when using those dimensions[Left,top,Width& Height], at asp.net page by using Divs & CSS...Total page gets collapsed and images just run away.........
Whats the best Approach to do this..??
As of now,am given Few images[Cut], and the original required Image..On seeing that , i should place images accordingly...
But Am not able to calculate dimensions for using at Html Divs and CSS in a ASp.net Page..
Have a look at below link. In that page if you mouse over on any thumbnail image a div opens with that image details with larger size. But there is a point to notice usually when an image gets downloaded in the browser we see that the image loads in parts from top to bottom. In this case the whole is loaded but in blurred state and gets cleared after fully downloaded.
Sample Link
I just wanted to know how this is achived? Does it require to code something or it is any javascript or dhtml?
i have a web page in asp.net.vb code and sql database.
the persons number is called PNUMB and i have stored all photos of persons in a folder with the persons number (PNUMB) as their file name. when i search for a PNUMB i want to display the photo of the persons whose dtata is displayed. how i sit possible
Am using a image cropper(custom control)what i need is i have to copy the cropped images and then save it wherever i want in local system (just like copy/paste in windows folders)..also need to copy the images from system and paste it to web page
I bind lable from database that show my users website address i want if user insert their website address in database and it show in lable image1.visible=true
and if in website column users don't insert any data image1.visible=false
Me with C# asp.net, In my web page I have an Iframe. I want to load another site in this Iframe and switch between diffrent pages in that loaded site with in this Iframe How I can do this?
I hav to show an image on the page, the image is generated vhen thu user sets some parameters. Now i have this image in the memore and I dont now how to show it without saving it on disk. I try to use DynamicImageControl but I dont know how to use it
I want to make some hyperlinks with images but when its clicked=when its on the page it represents it makes the image different. I know about the mouseover when you pass over them with the mouse but I DIDNT MEAN THAT. Just to be clear only changes image when its clicked=when its on the page that it represents.
how to load user control dynamically on asp.net page? I am loading user control in my page_Init() event under if(!IsPostBack) but when user post the with any button click then my user control is disapper?
If i am loading control without if(!IsPostBAck) then its fine, but each time a page is posted loading of control is not good because it will slow my web site?