There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Images & PHP


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
CyBerAliEn's Avatar
Senior Member with 1,215 posts.
 
Join Date: Nov 2001
Location: Glendale, AZ, USA
17-Jul-2002, 03:44 PM #1
Question Images & PHP
Hey,

First, I got a page which displays information. I am trying to setup something that will show (in percentage) 0-100 for the information given. That is all done. However, I cannot get the image to work as it should.

I have it setup so that the percantage is set as a variable, and that variable is plugged into the width of the image as a percentage.

Example (beginning and end of code cut off so it will show up here):

img src="image.jpg" width="$imagewidth%" height="10"

I've expiremented setting it SEVERAL different ways, but no matter what, the variable isn't coming through for the image, and it isn't working. And no, I left out the PHP on purpose, the above is not the full code. But if I set it up to echo the variable, it shows the correct value, but if I set it up for the image width in several different ways, it nevers comes up with it. I know I'm doing something wrong with the image & variable code together, but I have been unable to get it to work so far, although I am sure it is something very stupid

Andrew
DJ P@CkMaN's Avatar
Senior Member with 414 posts.
 
Join Date: Aug 2001
Location: Burpengary, QLD, Australia
17-Jul-2002, 10:25 PM #2
hmmm.. you are coding it wrong.

you need to put a slash before the "
eg.
PHP Code:
<?
echo "<img src=\"image.jpg\" width=\"$imagewidth%\" height=\"10\">"
?>
let me know if that works
CyBerAliEn's Avatar
Senior Member with 1,215 posts.
 
Join Date: Nov 2001
Location: Glendale, AZ, USA
18-Jul-2002, 12:46 PM #3
Hey,

Thanks for the help. I tried that and everything, couldn't understand why it wouldn't go. Then I figured out the problem was my functions and all, and that the way it was, if I had 100%, it would equal 0, so I got it fixed and now it is working, but thanks anyway!

if ($paymentmonthtotal>="70")
{
$g = "100%";
$n = "0";
$x = ($paymentmonthtotal-70);
$ed = "$x";
$mc = "Yes";
}
else
{
$n = (70-$paymentmonthtotal);
$c = (70-$n);
$a = ($c/70);
$b = ($a*100);
$g = "$b%";
$mc = "No";
$ed = "0";
}

Before it was just one set of variables and functions, but I had to split it up so that if it was 100%, it wouldn't show up as 0. And yes, I know I could probably cut down on some of the code above, but it is the way it is because of the information displayed on the page

Andrew
Snake~eyes's Avatar
Senior Member with 639 posts.
 
Join Date: Apr 2002
19-Jul-2002, 08:48 PM #4
Quote:
Originally posted by DJ P@CkMaN:
PHP Code:
<?
echo "<img src=\"image.jpg\" width=\"$imagewidth%\" height=\"10\">"
?>
also to make life easier you can jut do this

<img src="image.jpg" width="<? $imagewidth ?>%" height="10">"

that way you dont have to mess with the backslashes
CyBerAliEn's Avatar
Senior Member with 1,215 posts.
 
Join Date: Nov 2001
Location: Glendale, AZ, USA
20-Jul-2002, 11:22 AM #5
Hey,

Yeah... lol

But while on the subject of PHP, can anyone get me a direct URL for a download of a good PHP editor?

Thanks!

Andrew
Snake~eyes's Avatar
Senior Member with 639 posts.
 
Join Date: Apr 2002
20-Jul-2002, 11:45 AM #6
haha..

www.macromedia.com

homesite

its a 30 day trial with full features


its great go ahead and use it for 30 and thne lose it.. lol
CyBerAliEn's Avatar
Senior Member with 1,215 posts.
 
Join Date: Nov 2001
Location: Glendale, AZ, USA
20-Jul-2002, 12:59 PM #7
Hey,

Know of any good free ones then?

Andrew
Snake~eyes's Avatar
Senior Member with 639 posts.
 
Join Date: Apr 2002
20-Jul-2002, 11:29 PM #8
i know theres a good free one i dont remember the name but i'll get it
DJ P@CkMaN's Avatar
Senior Member with 414 posts.
 
Join Date: Aug 2001
Location: Burpengary, QLD, Australia
21-Jul-2002, 02:08 AM #9
hmmm.. nice to see your back

i didnt get you post about me

could you explain a little better??

thanx
Snake~eyes's Avatar
Senior Member with 639 posts.
 
Join Date: Apr 2002
21-Jul-2002, 10:58 AM #10
Quote:
Originally posted by DJ P@CkMaN:
hmmm.. nice to see your back

i didnt get you post about me

could you explain a little better??

thanx
huh?
CyBerAliEn's Avatar
Senior Member with 1,215 posts.
 
Join Date: Nov 2001
Location: Glendale, AZ, USA
21-Jul-2002, 11:14 AM #11
Hey,

OK...

I don't want to spend $100 on something I only need to use to edit PHP with the color doing and such. Nor do I want to download a version which will only last 30 days and that will take me awhile to download (damn 56k).

I've always come across stuff about "free PHP editor" but I've never really been interested until now.

Andrew
Snake~eyes's Avatar
Senior Member with 639 posts.
 
Join Date: Apr 2002
21-Jul-2002, 04:04 PM #12
okay.. i'll get the name of that free editor
segmented's Avatar
Junior Member with 24 posts.
 
Join Date: Apr 2003
09-Aug-2004, 06:11 AM #13
Quote:
Originally Posted by Snake~eyes
also to make life easier you can jut do this

<img src="image.jpg" width="<? $imagewidth ?>%" height="10">"

that way you dont have to mess with the backslashes

what are the backslashes for anyway?
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
09-Aug-2004, 10:38 PM #14
Backslashes are to escape special characters so that PHP doesn't try to interpret them.

Here are some free PHP Editors
http://www.phpide.com/forum/
http://www.chami.com/html-kit/
dmneoblade's Avatar
Senior Member with 266 posts.
 
Join Date: Apr 2004
Experience: Yes
10-Aug-2004, 07:18 PM #15
hunt down crimson editor. VERY nice stuff.
also, there is a problem in your code
PHP Code:
<?
print("<img src=\"image.jpg\" width=\"${imagewidth}%\" height=\"10\">");
//the brackets allow the % sign to go throug
//The print function makes your code cleaner
//And the missing semicolon is a syntax error.
?>
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 01:57 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.