LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-31-2008, 01:16 PM   #1
pandersson61
Member
 
Registered: Jan 2004
Distribution: Ubuntu 9.10, 10.04
Posts: 40

Rep: Reputation: 15
Help with displaying an image in PHP


To make things clear i don't know the first thing about programming, but i guess this one would be easy to solve if one knows php programming.
I'm using a squirrelmail plugin which contains the following code:

[HTML]if($junkfolder_useimage == true) {
$note .= '<img src="../plugins/junkfolder/images/warning.png" alt="Warning" title="Warning" align="center" /><br /> ';
}[/HTML]

And when it runs through the webserver the text comes out as this:

[HTML]<img src="../plugins/junkfolder/images/warning.png" alt="Warning" title="Warning" align="center" /><br />[/HTML]

If anyone knows how to fix this please let me know.

If someone is interested in the entire file it's avialable here:

http://www.squirrelmail.org/plugin_view.php?id=212

The file is called setup.php and has 143 lines so it's quite small.

Thanks!

/Peter
 
Old 07-31-2008, 08:08 PM   #2
derzok
Member
 
Registered: Aug 2004
Location: Ohio
Distribution: Debian, Slackware
Posts: 58

Rep: Reputation: 15
I don't see the problem. That script is doing exactly what it should do. It's saying "if the variable $junkfolder_useimage is true, print the line '<img src="../plugins/junkfolder/images/warning.png" alt="Warning" title="Warning" align="center" /><br />' into the variable $note. I would assume that later there is a line that says print $note - or maybe echo $note.

Because this is a php document, nothing will be displayed unless you TELL it to be displayed - that means using the print, echo, or printf commands. You should read an intro to PHP: http://us2.php.net/tut.php
 
Old 07-31-2008, 08:19 PM   #3
pandersson61
Member
 
Registered: Jan 2004
Distribution: Ubuntu 9.10, 10.04
Posts: 40

Original Poster
Rep: Reputation: 15
First of all thanks for replying!
This is not my code and i don't know the first thing about php. But it looks to me like the author tried to display an image instead of the code string. There is actually an image included in the path:

plugins/junkfolder/images/warning.png

But instead it's displaying the text:

<img src="../plugins/junkfolder/images/warning.png" alt="Warning" title="Warning" align="center" /><br />

Never mind that. I read the document and found a way to "turn off" php and display the image via "good old html".
Basically i added this in the middle of the middle of the file:

[HTML]?>
<img src="......... >
<?php[/HTML]

Not the most beautiful way to do it but at least it works!

Again thanks for your help!

/Peter
 
Old 07-31-2008, 09:40 PM   #4
Nauntilus
Member
 
Registered: Oct 2005
Distribution: All of them
Posts: 140

Rep: Reputation: 18
That looks like to coder was setting variable rather then displaying a picture, that is most likely the reason it was displaying the text. I am not sure, I haven't done much with PHP.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
php page displaying text that is supposed to be part of php code DragonM15 Programming 9 07-31-2008 04:58 PM
PHP: how can I return an image - not the html img src tag, but the image data BrianK Programming 3 05-18-2007 02:28 PM
php image blob managing cannot get image from html ilpadrino Programming 6 04-15-2007 09:05 AM
Displaying web images as background image on desktop Jarkandu Fedora 1 01-18-2007 04:49 AM
Webserver not displaying the new version of php??? Why? rajnair0278 Linux - Software 4 03-27-2006 07:08 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration