Simplistic approach help for me

Soldato
Joined
21 Jul 2005
Posts
20,701
Location
Officially least sunny location -Ronskistats
Guys I was wondering if you can point me in the right direction on a small web-page I want to work/practice on.

I have hosting and it provides MySQL, php facility (had this for some years but rarely use it due to other projects at work and little time) and I want to dabble in a simple display of data.

Basically what Im after is a list of information which will be held in the database, and with this an image. Rather than storing the image in the db (as i reckon this wont be the way) was wondering if hovering over the information or clicking it to bring up the image. Am I on the right path or is there a more direct way to achieve this?

Any advice im grateful for!

Th0nt
 
Are you trying to avoid storing the image in the database or the link/address to the image hosted elsewhere?

Personally I would sore the image link with the rest of the data to save headaches at a later date than trying to find a work around.
 
Thanks for your reply Nathan.

At the moment all I have done is a simple database with about 5 fields, and in my last field it contains the link address for the image. As it gets tricky displaying this from here I was wondering what other experienced people would tackle this with?
 
You don't need to upload the image into your database, you just get the data to refer to the image. If you have a unique key identifier, e.g. let's say ProductId, then this provides a unique number, e.g. 1, so then you just need to put an image called 1.jpg on your server, e.g. in images/products/1.jpg and then then when you pull the data from the database it can reference the image in this location.

As you add say products to your database, you can code a form to do this, and then you can have a second step which is a form that does the image upload to the location, i.e. images/products/1.jpg. You pick the image from your computer and it gets uploaded as the right number image and in the right location to be referenced by the data.

Rgds
 
Is there one image per set of records? Or do you wish to display an image to a keyword/link?

I'm having a little difficulty understanding exactly the effect you are looking for
 
Each record just would link to one specific image. Basically all im doing is a list of hills, some data like feet in height then I would like ot be able to view an image of the gradient. Probably simple but I seldom do web stuff nowadays.. :(
 
So.. if the gradiant was for example 30% you would hover over the 30% data and it would show the image stored on your harddrive for a 30% gradient?

If so its pretty simple and no need to store any image data on the database.

Use a simple CSS based pop-up such as follows:

Original code all credits to Stu Nicholls [CSSplay.co.uk]
Code:
Revised to make it work in Opera v9.01

a.screen, a.screen:visited {
color:#c00; 
position:relative; 
z-index:1;
}
a.screen b {
position:absolute;
visibility:hidden; /* hide the image */
width:200px; /* give it a width */
height:0; /* no height to solve an Opera bug that 
             makes it selectable when hidden */
border:1px solid #000; /* add a border */
left:0; /* position:the image */
top:-150px;
}
a.screen:hover {
text-decoration:none; 
border:0; /* needed for this to work in IE */ 
z-index:1000;
}
a.screen:hover b {
visibility:visible; /* make the image visible */
height:150px; /* now give it a height */
cursor:pointer; /* for IE */
z-index:500; 
}
a.screen:hover b img {
border:0; /* remove the link border */
}

All you want to do is echo the gradient data in the required places {noted by xxxx}, pretty straight forward and you will do this as your displaying the rest of the data to screen.

The typical xhtml link:

<a class="screen" href="#nogo">xxxx<b><img src="http://yoursite.co.uk/images/gradients/xxxx.gif alt="xxxx gradient" title="xxxx gradient" /></b></a>



Is this of any help?
 
Last edited:
Ahh OK then maybe badly described by me but I will expand as best I can.

The images will eventually be stored in a folder on my web-space, so the main information is stored in a single table in the database that I update as and when. All I would want is a simple page to display each entry, I just don't know what's the best way of displaying the gradient image, maybe only if the user requests it via a click or directly displaying it so people can glance at thumbnails?

I was originally going to use a blog like wordpress and include this inside. Maybe im complicating things but figured forumites here would know the best/simplest way to achieve what im after so that I dont waste hours/days on something that is a polished turd.
 
Last edited:
Back
Top Bottom