* User

Welcome, Guest. Please login or register.
Did you miss your activation email?

08 Sep 10, 14:55:00

Login with username, password and session length

Select language:

* Recent Topics



Donate

Donate for PortaMx !
Your donation is safe and helps support the issues and causes you care most about.

* Stats

  • *Total Members: 2448
  • *Latest: ElNikez

  • *Total Posts: 10789
  • *Total Topics: 1629
  • *Online Today: 20
  • *Most Online: 157
(27 Aug 09, 03:54:53)
  • *Users: 0
  • *Guests: 15
  • *Total: 15

Author Topic: image width and height problem  (Read 391 times)

0 Members and 1 Guest are viewing this topic.

Offline neverhurry

  • Full Member
  • ***
  • Posts: 228
  • Gender: Male
  • PortaMX fan
image width and height problem
« on: 20 Feb 10, 17:38:47 »
Hi,

I have a block with recent image attachment, the code is:

Code: [Select]
$attachments = ssi_recentAttachments(10, array('jpg', 'png', 'gif', 'bmp'), 'array');

foreach ($attachments as $item)
{
      echo '<div style="float:left;margin-right:5px">';
       echo '  <a href="',$item['topic']['href'],'"><img src="',$item['file']['image']['href'],'" width="100" height="" alt="',$item['file']['filename'],'" /></a><br />';
   
       
      echo '</div>';
}

echo '<div style="clear: both;" /></div>';


it works well but there is a problem: if the images are all horizontal (that is the width is bigger than the height) or all vertical (the image height is bigger than its width) then it is OK, but if there are images mixed horizontal and vertical then they don't look good together.

Problem is I set the img width to 100px, but I can not set the a fix height, that way the width-height proportion of many images will be changed, thus won't look good.

How to do so the width of the horizontal images and the height of vertical images will be the same 100 px while the width-height proportion of all the images will be remained unchanged.

Anybody has any experience with it? I tried today whole afternoon searching internet but no luck, that's why I am here asking for help from friendly people of this forum. Thank you people.

Offline antechinus

  • PortaMx Supporter
  • *
  • Posts: 686
Re: image width and height problem
« Reply #1 on: 20 Feb 10, 21:33:38 »
Easiest way is to forget about scaling the images and display them in fixed height divs or tables cells. That way at least they will all be in neat rows, even if the bottoms of the images in each row don't all line up.
Using Internet Explorer 6 on the internet is like urinating in a public swimming pool.
It's rude, there's no excuse for it, and anyone who does it should be ashamed of themselves.

Offline neverhurry

  • Full Member
  • ***
  • Posts: 228
  • Gender: Male
  • PortaMX fan
Re: image width and height problem
« Reply #2 on: 20 Feb 10, 22:40:53 »
OK, i see. I will take your advice. Thanks lot! regards, Paul