Jump to content

How to display images in html


swbdesigns

Recommended Posts

I have been reading "how to build a database driven site. using php and mysql" from sitepoint. All is well i have been creating their sample joke management CMS. I brought this book as i wanted to add a simple stock page to my website..

Now after reading the book i am a little lost at no point in the book did it touch on images. How would i pull images into a html page and set their size etc.  I want to put them into a <li> so i can style them ?

 

Link to comment
Share on other sites

The above is an example of how to take an image on your server and display it on an html/php page.

Note: do not place that tag in between the <?php and ?> tags as the above is just straight html.

 

However I notice your light mention of wanting to style the image or place it in a styled <il> tag. And how you want to be able to pull the image dimensions. As far as those go, styling the <il> will require at the minimum basic knowledge of CSS. If your seeking to style an image itself? Theres not much you can do to style it there are many effects you can use on images between CSS and JavaScript but in the end the image is just the image with applied effects over it so to speak. Which would require JavaScript knowledge as well.

 

To get the image dimensions themselves automaticly be it for resizing images, or just displaying the dimension your gonna most likely need some JavaScript there as well.

 

http://www.tizag.com/htmlT/

http://www.tizag.com/cssT/

 

I dont use the site anymore but when I was first starting out a few good years back, that was my favorite site to use, its very simple how they break things down, they give you small working samples, and you can go from there to more advance sites once you get the idea. Tizag is just a stepping stone a good guide for reference but not something you want to follow to an exact science.

Link to comment
Share on other sites

PHP is a processing language. When it comes to web, PHP doesn't display anything. It outputs text, usually in (X)HTML, though sometimes in XML or other forms, which is then interpreted by the browser to show you a website.

 

What you have to realize is that before you learn PHP, you need to learn what properly formed (X)HTML looks like, because that is what you will be outputting with PHP. If you don't know what properly formed (X)HTML looks like, then how will you know what you are supposed to output? It's like having a recipe for a cake, but not ever having actually seen what a cake looks like. You may be able to mix the ingredients, but if you manage to end up with something that actually looks like a cake, it will be pure luck and coincidence.

 

Many people try to skip learning (X)HTML before learning PHP, but that is a big, big mistake.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.