0

This is my code

$_SESSION['skin'] = 'kids';
$data = getimagesize("./skin/images/teaser/".$_SESSION['skin'].".jpg");

I'm getting this error:

mod_fcgid: stderr: PHP Warning:  getimagesize(./skin/images/teaser/skin.jpg): failed to open stream: No such file or directory

But I don't understand why the path is: ./skin/images/teaser/skin.jpg and not ./skin/images/teaser/kids.jpg

When I'm using var_dump on $_SESSION['skin'] just before getimagesize I get the correct output:

string(4) "kids"
Jaycaponex
  • 65
  • 7
  • Give remote path $size = getimagesize("http://www.example.com/gifs/logo.gif"); This function need a url of imagefile. – Afshan Shujat Apr 25 '16 at 10:35
  • Even with the url I geht the error. If I type in the path manually it works - if I use the Session Variable it doesn't work. – Jaycaponex Apr 25 '16 at 12:12
  • Can u share full code? it seems $_SESSION['skin'] value is updating somehow as your error message showing 'skin.jpg' instead 'kids.jpg' and you dont have any image with this name so error is throwing. You can try to assign $img = $_SESSION['skin']; $data = getimagesize("./skin/images/teaser/".$img.".jpg"); – Afshan Shujat Apr 26 '16 at 04:21
  • Possible duplicate of [Failed to open stream : No such file or directory](http://stackoverflow.com/questions/36577020/failed-to-open-stream-no-such-file-or-directory) – Vic Seedoubleyew Apr 26 '16 at 12:22

0 Answers0