Results 1 to 2 of 2

Thread: Align images on table

  1. #1

    Align images on table

    Im trying to create a function that will generate a catalog. I have this code that will create a table with three columns. It does work and displays everything fine. The problem comes when there are photos on the catalog that varying height, then the catalog looks disorganized. You can check an example of the function working at:
    http://www.tallercreativo.us/framewo...RE/catalog.php

    I would like to have all the text aligned vertically regardless of the image size. I was thinking about throwing a <tr> tag everytime there are images but im having trouble figuring it out. Please let me know if you have any suggestions.

    PHP Code:
        $count 0;
        while(
    $row mysql_fetch_array($result))
        {
            if((
    $count-(3*floor($count/3)))==0)
            {
                
    $table .= '<tr>';
            }
            
    $count++;

            
    $startlink '<a href="'.$_SERVER['PHP_SELF'].'?id='.$row['id'].'&show=1">';
            
    $table.='<td>';
            foreach(
    $array as $key => $value)
            {
                if(
    $key=='image')
                {
                    
    $trimmed trim($row[$value]);
                    if(
    $trimmed!='')
                    {
                        
    $table.=$startlink.'<img src="'.$imagefolder.$row[$value].'" />'.$endlink.'<br />';
                    }
                }
                elseif(
    $key=='title')
                {
                    
    $trimmed trim($row[$value]);
                    if(
    $trimmed!='')
                    {
                        
    $table.='<strong>'.$startlink.$row[$value].$endlink.'</strong><br />';
                    }
                }
                elseif(
    $key=='price')
                {
                    
    $trimmed trim($row[$value]);
                    if(
    $trimmed!='')
                    {
                        
    $table.='<span style="color:#F03;font-weight:bold;">$'.$row[$value].'</span><br />';
                    }
                }
                else
                {
                    
    $trimmed trim($row[$value]);
                    if(
    $trimmed!='')
                    {
                        
    $table.=$row[$value].'<br />';
                    }
                }
            }
            
    $table.='</td>';

            if((
    $count-(3*floor($count/3)))==0)
            {
                
    $table .= '</tr>';
            }
        }
        
    mysql_free_result($result); 
    "You are playing a very dangerous game"
    "Change always is"

    Creativo Development

  2. #2
    Why not tell the images to all be the same height?
    by the way, even though this was made with PHP it's a client side problem.
    Web Design and Web Development blog
    Designer Notice: Browser List for design compatibility

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012