Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

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

Posts: 322
Trades: 0
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
 
 
Register now for full access!
Old 02-21-2008, 08:58 PM Re: Problem with FF?
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
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 !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

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

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
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 |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
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
Ultra Talker

Posts: 322
Trades: 0
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,442
Name: James
Location: In the ocean.
Trades: 0
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: 462
Name: Jerod Lycett
Location: /home/arenlor
Trades: 0
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

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
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 |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
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
Ultra Talker

Posts: 322
Trades: 0
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: 462
Name: Jerod Lycett
Location: /home/arenlor
Trades: 0
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,935
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
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.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
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: 462
Name: Jerod Lycett
Location: /home/arenlor
Trades: 0
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,935
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
Arenlor: what happens in your setup if the page is resized? Is it server-side code or client side?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
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: 462
Name: Jerod Lycett
Location: /home/arenlor
Trades: 0
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
Ultra Talker

Posts: 322
Trades: 0
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:
Please login or register to view this content. Registration is FREE
Truly is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Problem with FF?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 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 1.23415 seconds with 12 queries