Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8145305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:37:21+00:00 2026-06-06T13:37:21+00:00

when I am displaying(PHP echo) an image name from the server,it’s shows like, Resource

  • 0

when I am displaying(PHP echo) an image name from the server,it’s shows like,

Resource id #32global_2012062513406170744fe83172d6c99.jpg
Resource id #33330394727_2012062613406707734fe90335d0a5e.jpg

How can I remove “Resource id #32” associated with image name? then only I can display the image from the server? Or there is any other way to display images?
code is

 69 if(is_dir($dir))
 70         {               
 71         $dir = opendir($dir);   
 72                 while (false !== ($file = readdir($dir)))
 73                 {       
 74                         if ($file != "." && $file != "..")
 75                         {
 76                                 $files[] = $file;
 77                         }
 78                 }
 79         closedir($dir);
 80         }
 81 //srand ((double) microtime( )*1000000);
 82 $randnum = mt_rand(0,(sizeof($files)-1));
 83 $img = $dir.$files[$randnum];
 84 echo $img;

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T13:37:23+00:00Added an answer on June 6, 2026 at 1:37 pm
    if(is_dir($dir))
    {               
        $openDir = opendir($dir);   
        while (false !== ($file = readdir($openDir)))
        {       
            if ($file != "." && $file != "..")
            {
                $files[] = $file;
            }
        }
        closedir($openDir);
    }
    //srand ((double) microtime( )*1000000);
    $randnum = mt_rand(0,(sizeof($files)-1));
    $img = $dir.$files[$randnum];
    echo $img;
    

    use this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code is not displaying the image from IIS 6/PHP 5.2.9. It works
How to create simple PHP COMET server page displaying current time? I need code
I have this PHP script which i'm grabbing images from a directory and displaying
I am retrieving values from a database and displaying it a table using php.
I have a .php file that looks like this: foreach($stmt->fetchAll() as $array) { echo
My PHP script is displaying the wrong time. For eg. the time on my
I'm very new to PHP and I have a small task of displaying a
I have a php website, where in the header i am displaying the facebook
I have this code for displaying content for login and registration in my PHP
When displaying all articles of a specific month (given through the urls like this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.