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 6550093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:10:28+00:00 2026-05-25T12:10:28+00:00

so my problem is that i have images storesd to a location on my

  • 0

so my problem is that i have images storesd to a location on my server (not the web root, for security purposes) and i have the path to these images stored in the database. i ues php along with pear’s html_template_it to display my pages. The only successful method of displaying the images has ben to modify the headers using

header("Content-type:image/type")
header("Content-Disposition:inline")
echo "<img src=readfile($image) />";

my problem is that this disrupts the template and whilst i get the image display, the template is gone. Can anyone advise on the best way to bypass this?

  • 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-25T12:10:28+00:00Added an answer on May 25, 2026 at 12:10 pm

    The proper way to do it would be to have something like:

    <img src="image.php?imageID=XYZ" />
    

    in your template, where XYZ is the image’s primary key in the database. Then you’d have the image.php script:

    <?php
    
    $id = $_GET['imageID'];
    $sql = "SELECT path FROM images WHERE id='" . mysql_real_escape_string($id) . "'";
    ... run query, fetch path, etc...
    
    header('Content-type: image/whatever');
    readfile($path);
    

    If you output an image/whatever content-type as you are in your code snippet, then you can’t wrap the image in some HTML, as the browser will interpret EVERYTHING your script sends as an image, and see a corrupted image – no image format on the planet has <img .... as its first few bytes.

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

Sidebar

Related Questions

I have some images stored in /images the problem is that i wish to
I have a problem where users are reporting that their images aren't being uploaded
I have a simple problem that I have not been able to find an
I have a problem that I have not faced before: It seems that the
I have a site that currently uses images on a file server. The images
I am having problem in displaying Tiff images in browser.I have my images stored
i have created one image but problem is that when i save image from
I have a problem that when I click on the image button instead of
Problem: I have a multipage TIFF image (generated with tiffutil) that contains the same
I have a problem with an image preview that comes up when you hover

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.