Loading ...
Sorry, an error occurred while loading the content.
 

RE: [php-objects] How to arrange image

Expand Messages
  • Ahsan Tohari
    Message 1 of 13 , Dec 31, 2009
      <?php
      include ("connect.php");// my database connect file
      $sql=mysql_query("select pictures from album where username='$username'");
      $i = 0;
      while($row=mysql_fetch_array($sql))
      {
      $imgsrc=$row[pictures];
      echo "<img src=$imgsrc height=150 width=150>";
      if ($i % 3 == 0) // 3 column (photos) per row, replace with desired number
      of column per row
      {
      echo "<p>";
      }
      $i++;
      }
      ?>


      _____

      From: php-objects@yahoogroups.com [mailto:php-objects@yahoogroups.com] On
      Behalf Of Gab Teo
      Sent: 31 Desember 2009 16:09
      To: php-objects@yahoogroups.com
      Subject: RE: [php-objects] How to arrange image





      Below is the script that echo out the photos,

      <?php



      include ("connect.php");// my database connect file

      $sql=mysql_query("select pictures from album where username='$username'");

      while($row=mysql_fetch_array($sql))

      {

      $imgsrc=$row[pictures];

      echo "<img src=$imgsrc height=150 width=150>";

      echo "<p>";

      }

      ?>

      I am currently having photos outputting in this form

      1

      2

      3

      4

      e.t.c

      and I want it in this form

      1 2 3

      4 5 6

      7 8 9

      e.t.c

      or

      1 2

      3 4

      5 6

      e.t.c

      Thanks,

      Gab
      --- On Wed, 12/30/09, Stan Rambin <serambin@ladatahost
      <mailto:serambin%40ladatahost.com> .com> wrote:

      From: Stan Rambin <serambin@ladatahost <mailto:serambin%40ladatahost.com>
      .com>
      Subject: RE: [php-objects] How to arrange image
      To: php-objects@ <mailto:php-objects%40yahoogroups.com> yahoogroups.com
      Date: Wednesday, December 30, 2009, 5:13 PM



      After reading the original e-mail, I checked and EW-3 SP1 had not installed

      on my 32bit Vista machine. I user automatic updates ans confirmed that my

      last update was 12/24/09. I then used the update feature manually and the

      patch installed fine. Just FYI.

      Thanks,

      Stan Rambin

      From: php-objects@ yahoogroups. com [mailto:php-objects@ yahoogroups. com]
      On

      Behalf Of Joe Forsythe

      Sent: Wednesday, December 30, 2009 9:06 AM

      To: php-objects@ yahoogroups. com

      Subject: Re: [php-objects] How to arrange image

      What is the code you're using right now so we can help you debug it?

      --

      Joe

      On Dec 30, 2009, at 3:49 AM, Gab Teo wrote:

      > Please can someone help, I just created a proile for users where

      > they can also upload their photo album, this is coming (outputing)

      > in one column and rows, and I want it to be in three column rows,

      > so that they can have their photos in three per column and as they

      > upload more photos it would be that this three column s maintain

      > down the rows. Can any one help me please.

      > Gab

      [Non-text portions of this message have been removed]

      [Non-text portions of this message have been removed]

      [Non-text portions of this message have been removed]






      [Non-text portions of this message have been removed]
    • Joe Forsythe
      You essentially have 3 problems. 1. HTML formatting. Just dropping in a tag without closing tags isn t up to standards. You also need quotes around your
      Message 2 of 13 , Dec 31, 2009
        You essentially have 3 problems.
        1. HTML formatting. Just dropping in a <p> tag without closing tags
        isn't up to standards. You also need quotes around your attributes
        for the image tag. *And* your image tag isn't closed. So, right now
        your formatting is like this:
        <img src=img-name-here.jpg height=150 width=150>
        <p>
        <img src=img-name-here.jpg height=150 width=150>
        <p>
        <img src=img-name-here.jpg height=150 width=150>
        <p>

        etc, etc, etc.

        This is what it *needs* to look like:
        <p><img src="img-name-here.jpg" height="150" width="150" /></p>
        <p><img src="img-name-here.jpg" height="150" width="150" /></p>
        <p><img src="img-name-here.jpg" height="150" width="150" /></p>

        2. You need to left align all of the first items you want in the row.
        So your new code would look like this:
        <p style="float:left;"><img src="img-name-here.jpg" height="150"
        width="150" /></p>
        <p style="float:left;"><img src="img-name-here.jpg" height="150"
        width="150" /></p>
        <p><img src="img-name-here.jpg" height="150" width="150" /></p>

        3. You need an additional check inside your while to make sure the
        <p> tag is supposed to be floated. Something like this would work:
        $i = 1;
        while($row=mysql_fetch_array($sql)) {
        $imgsrc = $row[pictures];
        $floated = '';
        if (($i % 3) == 0) { $floated = ' style="float:left;"'; }
        echo'<p'.$floated.'><img src="'.$imgsrc.'" height="150" width="150" /
        ></p>';
        $i++;
        }

        All of this adds up to a couple of things:
        1. You NEED to go back and learn HTML and CSS.
        2. Study loop logic.
        --
        Joe

        On Dec 31, 2009, at 3:08 AM, Gab Teo wrote:

        >
        > Below is the script that echo out the photos,
        >
        > <?php
        >
        >
        >
        > include ("connect.php");// my database connect file
        >
        > $sql=mysql_query("select pictures from album where
        > username='$username'");
        >
        > while($row=mysql_fetch_array($sql))
        >
        > {
        >
        > $imgsrc=$row[pictures];
        >
        > echo "<img src=$imgsrc height=150 width=150>";
        >
        > echo "<p>";
        >
        > }
        >
        > ?>
        >
        > I am currently having photos outputting in this form
        >
        > 1
        >
        > 2
        >
        > 3
        >
        > 4
        >
        > e.t.c
        >
        > and I want it in this form
        >
        > 1 2 3
        >
        > 4 5 6
        >
        > 7 8 9
        >
        > e.t.c
        >
        > or
        >
        > 1 2
        >
        > 3 4
        >
        > 5 6
        >
        > e.t.c
        >
        > Thanks,
        >
        > Gab
        >

        >
        > From: php-objects@ yahoogroups. com [mailto:php-objects@
        > yahoogroups. com] On
        >
        > Behalf Of Joe Forsythe
        >
        > Sent: Wednesday, December 30, 2009 9:06 AM
        >
        > To: php-objects@ yahoogroups. com
        >
        > Subject: Re: [php-objects] How to arrange image
        >
        > What is the code you're using right now so we can help you debug it?
        >
        > --
        >
        > Joe
        >
        >

        > On Dec 30, 2009, at 3:49 AM, Gab Teo wrote:
        >
        > > Please can someone help, I just created a proile for users where
        >
        > > they can also upload their photo album, this is coming (outputing)
        >
        > > in one column and rows, and I want it to be in three column rows,
        >
        > > so that they can have their photos in three per column and as they
        >
        > > upload more photos it would be that this three column s maintain
        >
        > > down the rows. Can any one help me please.
        >
        > > Gab
        >



        [Non-text portions of this message have been removed]
      • Behn00sh MoshtaGH
        Hi if you enjoy to use *div *i suggest this:
        Message 3 of 13 , Jan 2, 2010
          Hi
          if you enjoy to use *div *i suggest this:

          <?php
          include ("connect.php");// my database connect file
          $sql=mysql_query("select pictures from album where username='$username'");
          while($row=mysql_fetch_array($sql))
          {

          $imgsrc=$row[pictures];
          echo "*<div class="picarea">*<img src=$imgsrc height=150 width=150>*</div>*
          ";
          echo "<p>";
          }

          ?>
          then in your CSS file add this class:
          .*picarea
          {
          float:left;
          width:50%;
          }
          *
          On Thu, Dec 31, 2009 at 12:38 PM, Gab Teo <doneatlast1000@...> wrote:

          >
          >
          >
          > Below is the script that echo out the photos,
          >
          > <?php
          >
          >
          >
          > include ("connect.php");// my database connect file
          >
          > $sql=mysql_query("select pictures from album where username='$username'");
          >
          > while($row=mysql_fetch_array($sql))
          >
          > {
          >
          > $imgsrc=$row[pictures];
          >
          > echo "<img src=$imgsrc height=150 width=150>";
          >
          > echo "<p>";
          >
          > }
          >
          > ?>
          >
          > I am currently having photos outputting in this form
          >
          > 1
          >
          > 2
          >
          > 3
          >
          > 4
          >
          > e.t.c
          >
          > and I want it in this form
          >
          > 1 2 3
          >
          > 4 5 6
          >
          > 7 8 9
          >
          > e.t.c
          >
          > or
          >
          > 1 2
          >
          > 3 4
          >
          > 5 6
          >
          > e.t.c
          >
          > Thanks,
          >
          > Gab
          > --- On Wed, 12/30/09, Stan Rambin <serambin@...<serambin%40ladatahost.com>>
          > wrote:
          >
          > From: Stan Rambin <serambin@... <serambin%40ladatahost.com>>
          > Subject: RE: [php-objects] How to arrange image
          > To: php-objects@yahoogroups.com <php-objects%40yahoogroups.com>
          > Date: Wednesday, December 30, 2009, 5:13 PM
          >
          >
          >
          > After reading the original e-mail, I checked and EW-3 SP1 had not installed
          >
          > on my 32bit Vista machine. I user automatic updates ans confirmed that my
          >
          > last update was 12/24/09. I then used the update feature manually and the
          >
          > patch installed fine. Just FYI.
          >
          > Thanks,
          >
          > Stan Rambin
          >
          > From: php-objects@ yahoogroups. com [mailto:php-objects@ yahoogroups. com]
          > On
          >
          > Behalf Of Joe Forsythe
          >
          > Sent: Wednesday, December 30, 2009 9:06 AM
          >
          > To: php-objects@ yahoogroups. com
          >
          > Subject: Re: [php-objects] How to arrange image
          >
          > What is the code you're using right now so we can help you debug it?
          >
          > --
          >
          > Joe
          >
          > On Dec 30, 2009, at 3:49 AM, Gab Teo wrote:
          >
          > > Please can someone help, I just created a proile for users where
          >
          > > they can also upload their photo album, this is coming (outputing)
          >
          > > in one column and rows, and I want it to be in three column rows,
          >
          > > so that they can have their photos in three per column and as they
          >
          > > upload more photos it would be that this three column s maintain
          >
          > > down the rows. Can any one help me please.
          >
          > > Gab
          >
          > [Non-text portions of this message have been removed]
          >
          > [Non-text portions of this message have been removed]
          >
          > [Non-text portions of this message have been removed]
          >
          >
          >



          --

          Behn00sh Moshtagh
          --~--~---------~--~----~------------~-------~--~--


          [Non-text portions of this message have been removed]
        • Reji Jayan
          If i am right, i had read an old post for this. You can search google , how to display in rows an cols or something like this There is a lot of codes
          Message 4 of 13 , Jan 3, 2010
            If i am right, i had read an old post for this.

            You can search google ,

            "how to display in rows an cols" or something like this

            There is a lot of codes avaliable for this.

            No worries go ahead!!

            Thank You,

            Reji,
            PHP Developer.
            ==================



            --- On Wed, 30/12/09, Gab Teo <doneatlast1000@...> wrote:

            From: Gab Teo <doneatlast1000@...>
            Subject: [php-objects] How to arrange image
            To: php-objects@yahoogroups.com
            Date: Wednesday, 30 December, 2009, 3:19 PM







             









            Please can someone help, I just created a proile for users where they can also upload their photo album, this is coming (outputing) in one column and rows, and I want it to be in  three column rows, so that they can have their photos in three per column and as they upload more photos it would be that this three column s maintain down the rows. Can any one help me please.

            Gab



            [Non-text portions of this message have been removed]























            The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/

            [Non-text portions of this message have been removed]
          • Reji Jayan
            Hello All, Can any suggest me a Open source package,  for e-commerce, which have facilites for gift cheques, wishlists etc. Thank You, Reji, PHP Developer.
            Message 5 of 13 , Jan 7, 2010
              Hello All,



              Can any suggest me a Open source package,  for e-commerce,



              which have facilites for gift cheques, wishlists etc.



              Thank You,



              Reji,

              PHP Developer.
              ===============================



              The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/

              [Non-text portions of this message have been removed]
            Your message has been successfully submitted and would be delivered to recipients shortly.