Jump to content

Uploading Picture and Displayin it

- - - - -

  • Please log in to reply
3 replies to this topic

#1
tayolad

tayolad

    Newbie

  • Members
  • PipPip
  • 27 posts
After I Googled through, I later settled to save the path to an uploaded picture in the database and put the picture in a folder above the public folder (www). However, doing this was easy, whenever i wish to show the picture, i just get the picture ID, locate it in the database and extract the path from there, i then echo it. The problem i have is that the picture did not show and if i go through my cpanel, i see the picture there. the path is correct, i used to md5(the_path) before saving it. I checked through and i did not see anything wrong but yet the picture does not show via my php echo. I echoed the path and check with the one in the cpanel folder and evertything ok. The picture path is above the www. Any assistance on this will be appreciated before i grow grey hair. Thanks everyone

#2
Vaielab

Vaielab

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 547 posts
Can you post the url of this image, so we can take a look?

#3
yassinebelkaid

yassinebelkaid

    Newbie

  • Members
  • PipPip
  • 20 posts
Can you please provide us with the code?

#4
bbqroast

bbqroast

    Codecall Addict

  • Members
  • PipPipPipPipPipPipPip
  • 554 posts
  • Location:/etc/passwd
Are you using the appropriate version of
header('Type: image/png'); 
with your image?
Also I seem to remember a special function for echoing images.
imagepng($final);
That is for pngs but I'm sure there are variants also you can use:
$final = imagecreatefrompng("path to image from computer root!");
to fetch the image in the first place (it might even transform it for you!).
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users