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

  • SEARCH
  • Home
  • 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 7676537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:13:19+00:00 2026-05-31T17:13:19+00:00

I want to display an image using this php script on my server. $file

  • 0

I want to display an image using this php script on my server.

$file = fopen('/Volumes/PROMISE/products/jpeg/89239-282.jpg', 'rb');
header('Content-Type: image/jpeg');
fpassthru($file);

But i get an broken image, this script is at the top of my index file, right now for testing purposes, so i dont think theres an headers issue, infact its the only thing in my index file…

I’ve tried using

echo file_get_contents('/Volumes/PROMISE/products/jpeg/89239-282.jpg');

aswell, without any luck, the file exists at the specified path and it has 777 permission.

My last thoughts is that it might be some config on the apache server..? Dont know if theres even a setting that can brake the images?

This is the .htaccess file settings

Options +FollowSymlinks -Multiviews

This is the config from the httpd.conf file

Options All -MultiViews -ExecCGI -Indexes

I checked the mime.types file and the image/jpeg is active.

So i guess my question is: Is there some possibility the apache setup is messing with my images.

edit:

i tried using the code from php man

// Create a blank image and add some text
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  'A Simple Text String', $text_color);

// Set the content type header - in this case image/jpeg
header('Content-Type: image/jpeg');

// Output the image
imagejpeg($im);

// Free up memory
imagedestroy($im);

On my local computer it works, but not on our server. It gets me a blank page and no errors.

If i use imagejpeg with the second param and saves it to the desktop, it seems to be all fine and fully viewable

  • 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-05-31T17:13:20+00:00Added an answer on May 31, 2026 at 5:13 pm

    I have seen that issue many times. If you haven’t done so, try opening the broken image with a text editor to see if there is something wrong about it. Try a diff between the resulting file and the original file (from the server).

    Possible errors that come to mind: PHP notices or warnings displaying in your image, blank characters. For example, an empty line before the opening might break your image.

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

Sidebar

Related Questions

I want to display image using base64 encoding in IE using GWT If it
I want to display a simple GIF image in a VBox using GTK+ from
I have a 16 bit grayscale image that I want to display using WPF
I want to display a thumbnail image in a cell of tableViewController , this
I want to display an image within a scroll area. The view port of
I want to display an image at 'true size' in my application. For that
I want to display .jpg image in an Qt UI. I checked it online
If I want to display an image in my webpage and its src is
I want to display a png with flex's builtin image component. There's a specific
I would like to display an image composed of two images. I want image

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.