images aren't rendering


Posted on 16th Feb 2014 07:03 pm by admin

I'm trying to call a JPG file from within PHP (in an effort to hide the actual JPG folder). The image is supposed to be called at domain.com/photo/?id=X&i=Y where X is the gallery ID and Y is the image number, but it doesn't seem to be working. I've done this before but copying and pasting the code doesn't seem to be working. What am I missing?

Code: [Select] if (isset($_GET['id']) && isset($_GET['i'])) {

Did you know?Explore Trending and Topic pages for more stories like this.
//get folder location of photos
$gallery_path = mhp_get_gallery_filepath($_GET['id']).'/';

//return filenames of all jpgs in folder
$imgs = (mhp_img_list($gallery_path));

//get name of i-th jpg file
$img = $imgs[(int) $_GET['i']];

//check to see if the image exists
if (file_exists($gallery_path.$img) && is_readable($gallery_path.$img) && getimagesize($gallery_path.$img)) {
header('Content-Type: image/jpeg');
$orgimage = imagecreatefromjpeg($gallery_path.$img);
imagejpeg($orgimage, NULL, 90);
imagedestroy($origimage);
}

}
No comments posted yet

Your Answer:

Login to answer
55 Like 36 Dislike
Previous forums Next forums
Other forums

Echoing a Variable from a Object
How do I get a variable from the new User Class to echo out in this clasS?

class MyApp
{

xml
<?php

echo "<h1>XML Articles</h1>";

$home

Re-Order by ID Number
I have a cms set up for inputting an image, thumb, title, pdf, and eps. When input the database ass

type check while uploading
Hi Everyone,

How can I check the exact type of a file while uploading on my site?

Here

Basic Question Regarding PHP Includes
Hi

Just starting out with PHP.

Working on a site that uses some basic includes, these

Filtering for a phrase using pregmatch
Here is my code which looks for addresses which start with ' src=" '

Code: [Select]preg_

Images in email problem
I found this script for sending emails, it works but if the email has <img src="image.jp

Blank record injected into database
I always found several blank records inside my database, although $SESSION is required to insert the

Get word number x from string?
How can I use a function to loop through a string, and "have a look at" every word in the

Hit counter updating once per IP - IP HIT COUNTER
I have a hit counter, for the amount of views on a tutorial.
It'll do the query and then do..

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash