php extension and images

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
atomic.argonaut
Forum Newbie
Posts: 2
Joined: Sun May 01, 2011 7:50 pm

php extension and images

Post by atomic.argonaut »

Hi. I didnt really know whether to post this in general or in the area specific to code based questions but I'm trying to create a wordpress theme for a simple page with little knowledge of php. I'm having difficulty getting images to show with the standard src tag when the file is saved under a .php format but notice that when the same file is saved under .html the same images show up. Can anyone help me out? thanks!
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: php extension and images

Post by social_experiment »

Do you have any code to paste? For a php script to 'work' it has to be on a server that has php installed or the code wont be parsed as php.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
atomic.argonaut
Forum Newbie
Posts: 2
Joined: Sun May 01, 2011 7:50 pm

Re: php extension and images

Post by atomic.argonaut »

[syntax]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head profile="http://gmpg.org/xfn/11">



<title><?php bloginfo('style.css'); ?><?php wp_title(); ?

></title>



<meta http-equiv="Content-Type" content="<?php bloginfo

('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

<meta name="generator" content="WordPress <?php bloginfo

('version'); ?>" /> <!-- leave this for stats please -->



<link rel="stylesheet" href="<?php bloginfo

('stylesheet_url'); ?>" type="text/css" media="screen" />

<link rel="alternate" type="application/rss+xml" title="RSS

2.0" href="<?php bloginfo('rss2_url'); ?>" />

<link rel="alternate" type="text/xml" title="RSS .92"

href="<?php bloginfo('rss_url'); ?>" />

<link rel="alternate" type="application/atom+xml" title="Atom

0.3" href="<?php bloginfo('atom_url'); ?>" />

<link rel="pingback" href="<?php bloginfo('pingback_url'); ?

>" />



<?php wp_get_archives('type=monthly&format=link'); ?>

<?php //comments_popup_script(); // off by default ?>

<?php wp_head(); ?>

</head>

<body>

<img src="localhost/wordpress/wordpress/htdocs/wp-

content=themes/tutorial/banner.jpg">



<h3><span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span> <span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span></h3>

<h1><a href="<?php bloginfo('url') ?>"><?php bloginfo('name') ?></a>
</h1>
<?php bloginfo('description'); ?>
<img src="banner.jpg">
</body>

</html>
[/syntax]

theres the code. as far as the server being installed, ive xampp running and developing everything locally. wordpress itself works fine.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: php extension and images

Post by social_experiment »

Are the images placed correctly in accordance with their src attribute paths? The second img tag indicates that the image (banner.jpg) should be located in the root folder. It's also good practise to add width, height and alt to img tags.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
beetree
Forum Commoner
Posts: 26
Joined: Mon Jul 18, 2011 6:30 pm
Location: Peninsula

Re: php extension and images

Post by beetree »

If your PHP script simply is opening a image file, reading the data and then "echoing" it in the PHP script, you also need to add some headers if I'm not mistaken. /beetree
Post Reply