Hey guys,
I am new to PHP but have a good understanding of coding as I have done other languages for about a year now.
I did the PHP web gallery tutorial on : http://betterphp.co.uk/playlist.html?pi ... 2BCB69CCEC
But it wont work for me. It wont create a thumbnail folder or do anything on the page besides give me this:
[syntax=php]$thumb_aspect){ // wider $new_size = array(($thumb_width / $src_size[1]) * $src_size[0],$thumb_height); $src_pos = array(($new_size[0] - $thumb_width) * ($src_size[0] / $new_size[0])) / 2, 0); }else{ // same shape $new_size = array($thumb_width, $thumb_height); $src_pos = array(0, 0); } if ($new_size[0] < 1){$new_size[0] = 1; if ($new_size{1} , 1) $new_size[1] = 1; $thumb = imagecreatetruecolor($thumb_width, $thumb_height); imagecopyresampled($thumb, $src, 0, 0, $src_pos[0], $src_pos[1], $new_size[0], $new_size[1], $src_size [0], $src_size[1]); if ($src_size['mime'} === 'image/jpeg'){ imagejpeg($thumb, "thumbs/{$_GET['img']"); }else if ($src_size['mime'] === 'image/png'){ imagepng($thumb, "thumbs/{$_GET['img']"); }else if ($src_size{'mime'] === 'image/gif'){ imagegif($thumb, "thumbs/{$_GET['img']"); } header("location: thumbs/{@_GET['img']" } die(); if (is_dir('./thumbs') === false){ mkdir('./thumbs', 0744); } $images = glob('*.{jpg,jpeg,png,gif}', GLOB_BRACE); ?>|&{$image}\*"; }else{ echo "|&{$image}\*"; } } ?> [/syntax]
Please help me out here or will you send me a link to somewhere (tut or something) that could help me write a new one but properly ??
Thanx,
Josh
PHP web gallery from BetterPHP.co.uk
Re: PHP web gallery from BetterPHP.co.uk
Can you post the code in a way that it does not go all on one line ? ![Confused :?](./images/smilies/icon_e_confused.gif)
It's going to be pretty hard to debug like that![Wink ;)](./images/smilies/icon_e_wink.gif)
Also, do you get any errors ? If the thumbnail generation is failing the error may not be visible but you should see if if you browse to the location of the image which if I remember rightly is somethign like index.php?img=file.png
![Confused :?](./images/smilies/icon_e_confused.gif)
It's going to be pretty hard to debug like that
![Wink ;)](./images/smilies/icon_e_wink.gif)
Also, do you get any errors ? If the thumbnail generation is failing the error may not be visible but you should see if if you browse to the location of the image which if I remember rightly is somethign like index.php?img=file.png
Re: PHP web gallery from BetterPHP.co.uk
If that is the code you're trying to use then no wonder it doesn't work. It's all commented out
!
![Laughing :lol:](./images/smilies/icon_lol.gif)
-
- Posts: 4
- Joined: Mon Dec 05, 2011 1:26 pm
Re: PHP web gallery from BetterPHP.co.uk
EcazS wrote:If that is the code you're trying to use then no wonder it doesn't work. It's all commented out!
That is the result that is given when I open the page.
Re: PHP web gallery from BetterPHP.co.uk
If that is what you see when you open the page then your file does not have the .php extension or something is terribly wrong with your server.
-
- Posts: 4
- Joined: Mon Dec 05, 2011 1:26 pm
Re: PHP web gallery from BetterPHP.co.uk
EcazS wrote:If that is what you see when you open the page then your file does not have the .php extension or something is terribly wrong with your server.
It is a .php extension, I am using localhost. I've done it exactly like the tut.
Re: PHP web gallery from BetterPHP.co.uk
post your full code