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

Recommended Answers

All 4 Replies

Member Avatar for diafol
<img src="<?php echo "IMAGE/ITEMS/$image_folder_name";?>" />

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">
Member Avatar for LastMitch

@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";
  }
?>
commented: To Rectify what some retard did to LastMitch +0

@LastMitch,

Think line 7 is wrong way round

echo "<img src='IMAGE/ITEMS/$image_folder_name/{$img['file']}' /><br>\n";
commented: You are right. My bad. +7
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.