0

these 3 line store image in folder.

//place image in the folder
$ext = pathinfo($_FILES['image_file']['name'], PATHINFO_EXTENSION); //return png,jpg,etc
$image_folder_name = $user_user_name_s . '_' .  time()  . '.' . $ext; //create unife image name



move_uploaded_file($_FILES['image_file']['tmp_name'], "IMAGE/ITEMS/$image_folder_name"); //place image in folder

what is i want to print the image now. how can i do this

4
Contributors
4
Replies
5
Views
4 Years
Discussion Span
Last Post by Squidge
0

ic. here i have a table with 3 cols and 6 rows. like in code about that how user can upload a image and it store in a folder.

below inside this table i want to print all the images inside the folder. the problem is that there could be 1 image or 100 images. i was thinking of user a while loop sice i dont how the number of images.

echo"
        <div id = 'index_content_page_wrapper'>

            <table width='100%' border='1px' cellspacing='0' cellpadding='0'>
              <tr>
                <td>image 1</td>
                <td>image 2</td>
                <td>image 3</td>
              </tr>
              <tr>
                <td>random text 1</td>
                <td>random text 2</td>
                <td>random text 3</td>
              </tr>
              <tr>
                <td>random text 4</td>
                <td>random text 5</td>
                <td>random text 6</td>
              </tr>
              <tr>
                <td>image 4</td>
                <td>image 5</td>
                <td>image 6</td>
              </tr>
              <tr>
                <td>random text 10</td>
                <td>random text 11</td>
                <td>random text 12</td>
              </tr>
              <tr>
                <td>random text 13</td>
                <td>random text 14</td>
                <td>random text 15</td>
              </tr>
            </table>
            ";

iam think this:

<IMG 
   SRC="../graphics/moonflag.mpg" 
   DYNSRC="../graphics/moonflag.mpg"
   LOOP=INFINITE 
   ALT="a">

Edited by hwoarang69

6

@hwoarang69

I was thinking of user a while loop sice i dont how the number of images.

Try this

<?php
  // fetch image details
  $images = getImages("images");

  // display on page
  foreach($images as $img) {
    echo "<img src='IMAGE/ITEMS/{$img['file']}/$image_folder_name' /><br>\n";
  }
?>

Edited by LastMitch: grammer

Votes + Comments
To Rectify what some retard did to LastMitch
1

@LastMitch,

Think line 7 is wrong way round

echo "<img src='IMAGE/ITEMS/$image_folder_name/{$img['file']}' /><br>\n";
Votes + Comments
You are right. My bad.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.