swbdesigns Posted February 24, 2010 Share Posted February 24, 2010 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 ? Quote Link to comment Share on other sites More sharing options...
trq Posted February 25, 2010 Share Posted February 25, 2010 <img src="/path/to/image.jpg" /> Quote Link to comment Share on other sites More sharing options...
monkeytooth Posted February 25, 2010 Share Posted February 25, 2010 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. Quote Link to comment Share on other sites More sharing options...
haku Posted February 25, 2010 Share Posted February 25, 2010 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.