Welcome Guest, Not a member yet? Register   Sign In
Changing inline image widths programmatically.
#7

[eluser]John_Betong[/eluser]
 
Just ran some more tests and this is version 002.

1. image $width is calculated.
2. div-box is drawn with a width of 470px
3. $width is passed to the <img > display code
4. text is displayed in the div-box and floats around the image if and only if the image width is < 470px
otherwise text will follow the image

Code:
&lt;?php
        global $img;
        $img     = './images/please_lord.jpg';
        $dims    = getimagesize($img);
        // Debug stuff
        // echo '<pre>';
        //   print_r($dims);
        // echo '</pre>';
        // echo '$width = ' .$dims[0];
    ?&gt;
        
    
    <div style='width:640px; height:420px; margin:42px 0 0 42px; border:dotted 2px; background:#ffc; text-align:left; border:dotted'>
        <img src='&lt;?php echo $img ?&gt;' style='float:left; padding:1em; width:&lt;?php echo $dims[0] ?&gt;px; background:transparent' alt='fred' />
        Dear Lord, please grant me the ability to punch people in the face over TCP/IP.  
        Dear Lord, please grant me the ability to punch people in the face over TCP/IP.  
        Dear Lord, please grant me the ability to punch people in the face over TCP/IP.  
        Dear Lord, please grant me the ability to punch people in the face over TCP/IP.  
        Dear Lord, please grant me the ability to punch people in the face over TCP/IP.  
        Dear Lord, please grant me the ability to punch people in the face over TCP/IP.  
        Dear Lord, please grant me the ability to punch people in the face over TCP/IP.  
        Dear Lord, please grant me the ability to punch people in the face over TCP/IP.  
        Dear Lord, please grant me the ability to punch people in the face over TCP/IP.  
        Dear Lord, please grant me the ability to punch people in the face over TCP/IP.  
    </div>
&nbsp;
&nbsp;
&nbsp;
&nbsp;


Messages In This Thread
Changing inline image widths programmatically. - by El Forum - 07-17-2009, 03:37 AM
Changing inline image widths programmatically. - by El Forum - 07-17-2009, 12:56 PM
Changing inline image widths programmatically. - by El Forum - 07-17-2009, 12:59 PM
Changing inline image widths programmatically. - by El Forum - 07-17-2009, 01:27 PM
Changing inline image widths programmatically. - by El Forum - 07-17-2009, 05:49 PM
Changing inline image widths programmatically. - by El Forum - 07-17-2009, 06:28 PM
Changing inline image widths programmatically. - by El Forum - 07-17-2009, 07:13 PM
Changing inline image widths programmatically. - by El Forum - 07-17-2009, 07:25 PM
Changing inline image widths programmatically. - by El Forum - 07-17-2009, 09:23 PM
Changing inline image widths programmatically. - by El Forum - 07-17-2009, 10:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB