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'])) {

//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

that old Malformed Headers problem again!!!!! HELP!!!!!!
I've read the http://www.phpfreaks.com/forums/index.php/topic,37442.0.html

I don't think my c

dropdown box help - open php files to textarea
Hi, I am using tinymce to edit content located in several php files. The code I attached works but i

date("now") prints out wrong date ?
Hi Guys
Anyone know why and how I can fix it ?

problem with sql querry in php script
Hello guys,

What I want to do is I want to read out a csv file and then but te conent ot the

Email Form Syntax Issue
I need the TO: in email to display To: CEO instead of To: abc@mail.com

How to alter the scri

set xml path in flash when xml created in memorystream and webrequest
i am creating an xml file using memory stream and i want to load this xml file into the flash on cli

Local file browser with php
Halo..

So this is what i want to create. I have a folder that i share and it has many movies.

A rank users order by points
I want to make an insert from table 'rank' , with number (rank) from the cod blow, to fild users.ran

Create multiple (n) arrays
Hi there,

I have the following need:

I have 2 arrays (coming from a databases)

Socket problem
Hello,

Earlier I posted about my problem with my socket script. It took up to 100% CPU usage.

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