6 replies [Last post]
keyshey
keyshey's picture
Offline
Regular
Last seen: 12 years 6 weeks ago
Joined: 2007-10-31
Posts: 20
Points: 0

hi guys,

I've been having problems w/ a site that Im working on. I'm trying to post all pictures in 50% width and height.

I tried using this but it doesnt appear to work;

.box .pview { border-color: gray; width: 50%; height: 50%; }

So, what I did is I tried using php to get the actual width and height of the image, then I divide it by 2 to get the 50%. The values that Im getting are correct, but it appears like the image is having a width and height of both zero.

<?php
$myimage = array_values(getimagesize("../tier1kb/images/".$line[$emplengthf - 2].".JPG"));
list($width, $height, $type, $attr) = $myimage;
// the 1st two lines takes the width and the height of the image
$width = 0.5 * $width; //this makes the width 50%
$height = 0.5 * $height; //this makes the height 50%
$kulay = gray; // variable i used for the border-color
echo ''; // the next lines would be for the CSS
echo '.box .pview';
echo '{ width: '.$width.'px; border-color: '.$kulay.';height: '.$height.'px;}';
echo '';
?>

Can you guys help me with this please? Or if you have a much easier way to do this, that would be great!

Thanks!

________________________________________________________________________

http://keyjey.110mb.com/
http://couchiswhereisleep.co.cc/

thepineapplehead
thepineapplehead's picture
Offline
Guru
Last seen: 36 weeks 2 days ago
Joined: 2004-06-30
Posts: 9668
Points: 801

Can you show us the HTML

Can you show us the HTML you're working with?

Verschwindende wrote:
  • CSS doesn't make pies

keyshey
keyshey's picture
Offline
Regular
Last seen: 12 years 6 weeks ago
Joined: 2007-10-31
Posts: 20
Points: 0

guys nevermind, I found a

guys nevermind, I found a fix for it.

thanks still!
Smile

________________________________________________________________________

http://keyjey.110mb.com/
http://couchiswhereisleep.co.cc/

thepineapplehead
thepineapplehead's picture
Offline
Guru
Last seen: 36 weeks 2 days ago
Joined: 2004-06-30
Posts: 9668
Points: 801

Solved!

How did you fix it? For future reference, in case someone has a similar problem?

Verschwindende wrote:
  • CSS doesn't make pies

keyshey
keyshey's picture
Offline
Regular
Last seen: 12 years 6 weeks ago
Joined: 2007-10-31
Posts: 20
Points: 0

unfortunately, for this one

unfortunately, for this one i had to stay away from CSS to attain the effect im looking for.

i had to use the actual width and height in the img>,
instead of using:

echo 'style>'; // the next lines would be for the CSS echo '.box .pview';
echo '{ width: '.$width.'px; border-color: '.$kulay.';height: '.$height.'px;}';
echo '/style>';

I did echo 'img width = "'.$width.'" height = "'.$height.'">';

it worked out fine because i was using a loop for all my images so i didnt have to write it for all the images,

________________________________________________________________________

http://keyjey.110mb.com/
http://couchiswhereisleep.co.cc/

thepineapplehead
thepineapplehead's picture
Offline
Guru
Last seen: 36 weeks 2 days ago
Joined: 2004-06-30
Posts: 9668
Points: 801

Glad you figured it out. You

Glad you figured it out. You can't use CSS in the way you were trying to squash or stretch images, but you figured out how to edit the HTML which I was going to suggest. Excellent!

Verschwindende wrote:
  • CSS doesn't make pies

keyshey
keyshey's picture
Offline
Regular
Last seen: 12 years 6 weeks ago
Joined: 2007-10-31
Posts: 20
Points: 0

yeah thankfully it worked

yeah thankfully it worked out,

this site is also helping out a lot
im fairly new to making websites, especially to CSS (probably along the below intermediate line), but im getting a lot of clues by reading the posts here!

thanks!

________________________________________________________________________

http://keyjey.110mb.com/
http://couchiswhereisleep.co.cc/