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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:37:27+00:00 2026-06-12T14:37:27+00:00

In an attempt to keep user images safe, I am storing them outside the

  • 0

In an attempt to keep user images safe, I am storing them outside the webroot and calling upon them with an id check within an additional “image.php” script. The script reads as follows.

session_start();
require("scripts/sqlconnect.php"); 
$id = $_SESSION['id'];
$img = $_GET['id'];
$img = stripslashes($img);
$img = strip_tags($img);
$sql = mysql_query("SELECT * FROM photos WHERE id='$id'");   
$salt = mysql_query("SELECT * FROM members WHERE id='$id'");
$salt = mysql_fetch_array($salt);
$salt = $salt['salt'];
while($row = mysql_fetch_assoc($sql)){
    $imgfp = $row['filepath'];
    if(hash('sha256', $imgfp.$salt)==$img){
        $data = getimagesize($imgfp);
        if(!$data){
            header('HTTP/1.0 403 Forbidden');
            die('The file you requested is not an image.');
        }
        header('Content-type: ' .$data['mime']);
        header('Content-length: ' .filesize($imgfp));
        readfile($imgfp);
    }
}

The problem I am running in to is utilizing FancyBox with such a script. When I link to these images (as shown below), the FancyBox fails to work and it just links directly to the image. Does anyone have experience with FancyBox or a similar script that would cater to this method for calling upon images?

<a class="fancybox" rel="'.$relgroup.'" href="image?id='.$photofp.'" title="'.$pinfo.'"><img class="tnail" src="'.$tnail.'" /></a>

The onload js added for FancyBox is this:

$(".fancybox")
    .fancybox({
        padding : 0,
        'scrolling' : 'no',
        helpers : {
            title   : {
            type: 'outside'
            },
        }
    });
  • 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-12T14:37:28+00:00Added an answer on June 12, 2026 at 2:37 pm

    I figured this out with assistance from JFK in comments above.

    I created a new class .fancyboximg and added the image type to that class along with the original onload changes stated in opening post.

    Images now open in the FancyBox as desired!

    $(".fancyboximg")
    .fancybox({
        'type' : 'image',
        padding : 0,
        'scrolling' : 'no',
        helpers : {
            title   : {
            type: 'outside'
            },
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using jQuery validation to attempt to keep a user from posting back
The Tastypie documentation states that bundles keep Tastypie more thread-safe but does not explain
At one point in my app, the user selects an image from a Gallery
Here's the flow I'm looking for for authentication: Attempt to pull in the user's
First attempt to use this cool site - after searching for 2 hours: So
My attempt to customize the method contains of ArrayList, I used Eclipse to generate
I attempt to use webservice return POCO class generated from entity data model as
The following is my attempt at a prepare statement. It is causing the page
In an attempt to achieve git nirvana, I'm spending the day learning how to
This is my first attempt at responsive design, so I'm keeping it simple. I

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.