Jump to content

Unable to align properly


singhnsk

Recommended Posts

First of all, here's what i want it to look:'

wish.jpg

 

I just want that the related image must align towards left, and its information is just in front of it. :'(

But, what my code does is place the image on above line, and the information on the link below. Here's how it looks with my code. 

actual.png

I will be able to make the changes with the File Information.

 

The PHP which is being used is:

1. To fetch if preview is available:

$pre = '';
  		if ($prew==0)
  		{
   			if ($ext == 'bmp') $pre = 'Impossible Preview <br>';
   			if ($ext == 'gif' or $ext == 'jpeg' or $ext == 'jpg' or $ext == 'png' or $ext == 'JPG' or $ext == 'GIF' or $ext == 'PNG'or $ext == 'JPEG') $pre = '<img style="align:left;margin: 1px;" src="im.php?bab=1&id='.$file_info['id'].'" alt=""/>';
  		}

2. To insert the preview image:

if($pre!=NULL) echo '<div class="block">'.$pre.'</div>';

 

3. And finally the code to fetch file information:

echo '<div class="fileName"><a href="load.php?id='.$file_info[id].'"><font color="red">'.$file_info['name'].''.$extension.'</font></a>|';
       if($ext =='txt')     {  echo '<a href="read.php?id='.$file_info['id'].'&id2='.$id.'"><font color="red">Read</font></a>';}
            echo $new_info.'';
  		if(!empty($file_info['fastabout'])) echo str_replace("\n", '<br>',$file_info['fastabout']);
  		echo '</div>';
echo '<tr><div class="t_block">'.$ico.'<a href="view.php?id='.$file_info[id].'"><strong>File Info</strong></a></div></tr></td>';

 

I just can't figure out what to insert with the code. I think it must be some table formatting (TR/TD), but because I'm a noob with PHP, I failed in all my attempts.

Please, if anyone could help me out!

Link to comment
https://forums.phpfreaks.com/topic/232145-unable-to-align-properly/
Share on other sites

With css the simple answer is to use a css style for the image that does:

 

float: left;

 

You should output the image first.  Additional text will flow around the image.  There's no need for tables, and I would avoid them for this.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.