Reply
Problem with FF?
Old 02-21-2008, 04:09 PM Problem with FF?
Truly's Avatar
Extreme Talker

Posts: 214
Does firefox not accept % when declaring the height/width of an image.

Im using this code (I know its ugly and should just make the whole line php to get rid of all those tags but Ill do that later :P)
PHP Code:
        <span class="newsImage">
        <? if ($row['image']!=""){?><img width="<?php echo $row['imgsize']; ?>" height="<?php echo $row['imgsize']; ?>" src="<?php echo $row['image']; ?>"><?php ?>        
        </span>
Basically i set "imgsize" in the database and it is equal to "50%" or "100%" or w/e I decide. Now this works fine with IE but doesnt work with FF, although if I remove the % and just make it a fixed number then it works.

Any thoughts?

Last edited by Truly : 02-21-2008 at 04:10 PM.
Truly is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 02-21-2008, 08:58 PM Re: Problem with FF?
LadynRed's Avatar
Super Moderator

Posts: 6,572
Location: Tennessee
Just because IE does it doesn't make it right.

You can't specify a percentage width in CSS for an image.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 02-21-2008, 09:02 PM Re: Problem with FF?
vangogh's Avatar
Post Impressionist

Posts: 8,831
Name: Steven Bradley
Location: Boulder, Colorado
I think the issue is that you only need to specify either the width or height, but not both. The other should by default use the same %. Try it without the code for height and see if that works.
__________________
l Search Engine Friendly Web Design | Van SEO Design
l Tips On Marketing, SEO, Design, and Development | TheVanBlog
l Custom WordPress Themes
| Small Business Forum
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 02-24-2008, 10:55 PM Re: Problem with FF?
Truly's Avatar
Extreme Talker

Posts: 214
I gave it a try but it didnt work. Any other ideas?

So LadynRed does that mean that I cant resize images in FF?
Truly is offline
Reply With Quote
View Public Profile
 
Old 02-24-2008, 11:02 PM Re: Problem with FF?
joder's Avatar
Flipotron

Posts: 6,443
Name: James
Location: In the ocean.
It can be done with Javascript or PHP. There are scripts out on the web.
joder is offline
Reply With Quote
View Public Profile
 
Old 02-25-2008, 12:43 AM Re: Problem with FF?
Arenlor's Avatar
Ultra Talker

Posts: 463
Name: Jerod Lycett
Location: /home/arenlor
Why is it that you're trying to resize the image? Are all images supposed to be a certain size on your site, if so it'd make more sense to just hardcode it in.
__________________
PHP Code:
<?php echo "Hello World"?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
Arenlor is offline
Reply With Quote
View Public Profile Visit Arenlor's homepage!
 
Old 02-25-2008, 07:53 PM Re: Problem with FF?
vangogh's Avatar
Post Impressionist

Posts: 8,831
Name: Steven Bradley
Location: Boulder, Colorado
Here's another thought. Is the % character being stored in the database? I don't see where you're including it in the code. If you're not including the % character I would think you would have to and if you're pulling it from the database could that be what's tripping up FF.

Would this work

PHP Code:
<? if ($row['image']!=""){?><img width="<?php echo $row['imgsize'] . "%"?>" height="<?php echo $row['imgsize'] . "%"?>" src="<?php echo $row['image']; ?>"><?php ?>
__________________
l Search Engine Friendly Web Design | Van SEO Design
l Tips On Marketing, SEO, Design, and Development | TheVanBlog
l Custom WordPress Themes
| Small Business Forum
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 02-28-2008, 01:11 AM Re: Problem with FF?
Truly's Avatar
Extreme Talker

Posts: 214
Ya I am pulling it from the DB I will have to try changing it and putting it int he code.

Arenlor the reason I am not hardcoding it is because I am using this for news articles on the front of my page and I am just taking images from the sources and placing them on the front page. If I hard coded it it would look odd because they are not all the same dimensions so I need to use percentages but I have to be able to change the percentages because they are all different sizes. Could I edit them? Sure, but why waste the time.

Thanks for the suggestions vangogh.
Truly is offline
Reply With Quote
View Public Profile
 
Old 02-28-2008, 01:18 AM Re: Problem with FF?
Arenlor's Avatar
Ultra Talker

Posts: 463
Name: Jerod Lycett
Location: /home/arenlor
I wish I had the code I had used to do this the one time, but basically I had known max dimensions, then I resized according to that, in pseudo code:
Quote:
if(width>max_width){get percentage needed, assign it to w}
if(height>max_height){same, assign it to h}
if(h || w is set){
if(h is set && w is set){find the smaller, assign it}
elseif(h is set){assign it}
else{assign w}
}
I did it and it worked quite nicely, I had an actual image gallery created with thumbnail previews using this code, but lost the code.
__________________
PHP Code:
<?php echo "Hello World"?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
Arenlor is offline
Reply With Quote
View Public Profile Visit Arenlor's homepage!
 
Old 02-28-2008, 02:05 AM Re: Problem with FF?
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Actually, what you're doing is possible, but it comes with two caveats:

1) It can't be done with percentages; it can be done with ems, but ems are relative to the parent element, so you might not always get the default image size that you want.

2) If you allow users to resize the images, you're going to get some really nasty results in some cases. Browsers don't do a very good job of image resizing.

I've whipped up a quick demo so that you can see what I'm talking about.
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 02-28-2008, 03:10 AM Re: Problem with FF?
Arenlor's Avatar
Ultra Talker

Posts: 463
Name: Jerod Lycett
Location: /home/arenlor
Using my pseudo system you'd just be setting <img src="the.img" alt="Alternate Text" width="w" height="h">
__________________
PHP Code:
<?php echo "Hello World"?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
Arenlor is offline
Reply With Quote
View Public Profile Visit Arenlor's homepage!
 
Old 02-28-2008, 11:53 AM Re: Problem with FF?
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Arenlor: what happens in your setup if the page is resized? Is it server-side code or client side?
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 02-28-2008, 01:22 PM Re: Problem with FF?
Arenlor's Avatar
Ultra Talker

Posts: 463
Name: Jerod Lycett
Location: /home/arenlor
h and w are px sizes in my setup, sorry I didn't make that clear. It gets a percentage based on what percent your chosen size is of the actual images size, for example if you wanted it to be 100x100 and the image was 1000x200 it would make it 100x20 since it'd use the smaller of the two (10% and 50%)
__________________
PHP Code:
<?php echo "Hello World"?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
Arenlor is offline
Reply With Quote
View Public Profile Visit Arenlor's homepage!
 
Old 03-02-2008, 10:57 AM Re: Problem with FF?
Truly's Avatar
Extreme Talker

Posts: 214
Thanks for the suggestions. Ya Adam Im going to stay away from em, I dont want to go down that road.

Arenlor thats a good idea I will try that and see how it works out. If it does I will post the code so you will have it for next time since you lost it
__________________
DVD Movie Release Database: http://www.couchpotatoesonline.com
Truly is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Problem with FF?
 

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.20226 seconds with 12 queries