Hello, Im Jeffrey McCain!

Im Trying To Build A Website And The Last Thing I Need To Know How To Do Is Display Imade From A Datbase! I Found A Tutorial > < But I Don't understand How To Implement It! I Will Glady Pay ANOYONE Who Can Show Me Step For Step How To Do This And Apply It To My Web Design! Don't Want To Discuss Price Until I Know Someone Is Not Gonna Pull my Leg! But You Will Be Rewarded! Thanks. E-Mail If You need To Or I Can Provide My Phone Number! > E-mail = jcreate4@gmail.com

Jeffrey D. mcCain

Dani AI

Generated

Quick, practical plan for showing images — two common options and working examples so you can follow step‑by‑step.

Prefer storing files on disk (or S3) and saving the file path in the database — simpler, faster, and easier to back up. Storing image bytes (BLOB) in the DB is possible and shown below, but use it only if you need transactional storage or have a small site.

Save upload to disk and store path (recommended)

// upload.php (very small example — validate in real use)
if ($_FILES['image']['error']===UPLOAD_ERR_OK) {
  $ext = pathinfo($_FILES['image']['name'], PATHINFO_EXTENSION);
  $name = uniqid('img_').".$ext";
  move_uploaded_file($_FILES['image']['tmp_name'], __DIR__.'/uploads/'.$name);
  $stmt = $pdo->prepare('INSERT INTO images (orig_name,mime,path) VALUES (?,?,?)');
  $stmt->execute([$_FILES['image']['name'], $_FILES['image']['type'], 'uploads/'.$name]);
}

Then display in HTML with <img src="uploads/yourfile.jpg" alt=""> or protect access via a script that checks permissions.

Serve an image stored as a BLOB (when you must)

// image.php?id=123
$id = (int)($_GET['id'] ?? 0);
$stmt = $pdo->prepare('SELECT mime,data FROM images WHERE id=?');
$stmt->execute([$id]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if ($row) {
  header('Content-Type: '.$row['mime']);
  header('Cache-Control: public, max-age=86400');
  echo $row['data'];
}

Common gotchas and tips

  • Check upload_max_filesize, post_max_size, and memory_limit.
  • Use PDO or mysqli with prepared statements to avoid SQL injection.
  • Validate MIME type and file extension; reject executables.
  • Ensure no extra whitespace/BOM before header() calls when streaming images.
  • Prefer thumbnails (create with GD/Imagick) for lists; avoid serving full-size images everywhere.
  • For production, consider object storage + CDN for performance and to avoid bloating the DB.

If you want someone to implement this for you, follow ’s advice and use the Business Exchange area; public threads work best for concise, focused questions.

Recommended Answers

All 10 Replies

Because I Left The Form Sitting For A Couple of Days.

Member Avatar for Member #120589

That's really rude. Would've helped you learn how to do it. Never mind. Good luck.

Member Avatar for Member #949455

Because I Left The Form Sitting For A Couple of Days.

Just post your question in the Business Exchange section because that's where people post work and offer jobs not here because it's for members post issues and questions.

Don't Get So Sensitive Diafol.... You Forgeting Im New Here! Cry Me A River Buddy!

As For Mitch... Thanks For The Help, I'll Be Sure To Check That Out!

Member Avatar for Member #120589

Don't Get So Sensitive Diafol.... You Forgeting Im New Here! Cry Me A River Buddy!

Not sensitive, just can't be arsed with time wasters.

You Forgeting Im New Here!

Hint - as a noob, learn some manners. You'll get more results.

Cry Me A River Buddy!

I don't think so - you're the guy who needs help, not me. :)

Sensitivity At Its Finest! > "Thats Was Rude, I Don't Wanna Helop You Anymore.. Pout Pout Pout!" The Last Thing You Told me In the Form Before Was To Go get help For Someone Else And The Work Wasn't Going To Be Cheap. If You Got Offend Because i Decided To Repost Again... Your Gonna Have Toughing Up Buddy! Take Care.

Member Avatar for Member #120589

Au contraire. I was waiting for you to come back with something useful, after the options given to you, lastly by utrivedi. Then you decided to start a repeat thread. That's a snub pure and simple. You want to pay somebody fine, but an open forum like this isn't really the place as any old idiot can say 'yeah I'll do it' - no refs, nothing. Anyway, seems from the original thread that you have your programmer for hire. Good luck, 'Buddy'.

yeah whatever. sniff sniff

No, You Know What.... If I Offended You In Any Way, i Surely Apologize Al. Take Care.

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.