Current location: Hot Scripts Forums » Programming Languages » PHP » Gallery script, can someone check the programming?


Gallery script, can someone check the programming?

Reply
  #1 (permalink)  
Old 09-24-03, 07:28 AM
Pvasoldier Pvasoldier is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Gallery script, can someone check the programming?

Hi, I found an awesome gallery script and ahve installed it on my website. It ahs automatic thumbnail generation but i cant get it to work can someone check the script and see if its ok?

the problem can be seen at www.lawsofshotgun.com/Photos/albums.php

the script is found at http://www.pepperview.com/lefab/ezal...mentation.html

but the problem lies in this section:

{$image = $album->images[$firstIndex + $i + $album->firstImage];
$thumbnailPath = $thumbnailsFolder . "/" . $image->getThumbnail();
if ( !file_exists( $thumbnailPath ) ) // create and cache the thumbnail image if not here

{ $imagePath = $album->imagesFolder . "/" . $image->getFileName();
$im = @ImageCreateFromJPEG ($imagePath);
$size = GetImageSize($imagePath);
$imageWidth = $size[0];
$imageHeight = $size[1];

$thumbWidth = floor( $album->cellsWidth );
$thumbHeight = floor( ( $imageHeight * $album->cellsWidth ) / $imageWidth );

if ( $thumbHeight > $album->cellsHeight )
{
$thumbWidth = floor( ( $imageWidth * $album->cellsHeight )/ $imageHeight );
$thumbHeight = floor( $album->cellsHeight );
}

$tn = ImageCreate($thumbWidth, $thumbHeight);
imagecopyresized($tn, $im, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imageWidth, $imageHeight);
imagejpeg( $tn, $thumbnailPath );
ImageDestroy( $tn );
ImageDestroy( $im );
}


$t->assign('SRC', $base . "http://www.lawsofshotgun.com/Photos" . $thumbnailsRelativeURL . "tn" . $image->getThumbnail() );
$t->assign('CELLS_HEIGHT', $album->cellsHeight);
$t->assign('CELLS_WIDTH', $album->cellsWidth);
$t->assign('ALBUM_SOURCE', $album_source);
$t->assign('IMAGE_NUMBER', $i + $firstIndex );

$t->parse('CELL', $tag);
$tag = ".cell";
}


Thanks so much for anyone who can help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 09-24-03, 08:32 AM
YourPHPPro's Avatar
YourPHPPro YourPHPPro is offline
Community VIP
 
Join Date: Aug 2003
Posts: 430
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Pvasoldier
but i cant get it to work can someone check the script and see if its ok?
The only error I saw was something like:

Unable to open '/home/lawsofsh/public_html/Photos/albums/tn/band1_tn.jpg' for writing in /home/lawsofsh/public_html/Photos/album.php on line 63

which normally means that you have a permissions problem or an incorrect directory configuration. Was that the error you were asking about ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 09-24-03, 08:59 AM
Pvasoldier Pvasoldier is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
yes

Quote:
Originally Posted by YourPHPPro
The only error I saw was something like:

Unable to open '/home/lawsofsh/public_html/Photos/albums/tn/band1_tn.jpg' for writing in /home/lawsofsh/public_html/Photos/album.php on line 63

which normally means that you have a permissions problem or an incorrect directory configuration. Was that the error you were asking about ?
Yeah that was the error I chmod the permissions to 777 and i dont get the error anymore but still no thumbnails? Any ideas?

www.lawsofshotgun.com/Photos/albums.php

Also im tryig to add a simple guestbook to the thumbnail page.

Last edited by Pvasoldier; 09-24-03 at 09:09 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 09-24-03, 09:09 AM
YourPHPPro's Avatar
YourPHPPro YourPHPPro is offline
Community VIP
 
Join Date: Aug 2003
Posts: 430
Thanks: 0
Thanked 0 Times in 0 Posts
What 'loads of things' have you done to try and correct the error ?

My suggestions would be:

Does the directory (/home/lawsofsh/public_html/Photos/albums/tn/) actually exist on the server ?

Are the permissions correct to allow PHP to write to that directory ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 09-24-03, 09:11 AM
Pvasoldier Pvasoldier is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by YourPHPPro
What 'loads of things' have you done to try and correct the error ?

My suggestions would be:

Does the directory (/home/lawsofsh/public_html/Photos/albums/tn/) actually exist on the server ?

Are the permissions correct to allow PHP to write to that directory ?
chmod the permissions to 777 and this got rid of the error not the lack of thumbnails?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 09-24-03, 09:45 AM
YourPHPPro's Avatar
YourPHPPro YourPHPPro is offline
Community VIP
 
Join Date: Aug 2003
Posts: 430
Thanks: 0
Thanked 0 Times in 0 Posts
Does your phpinfo page show that GD is installed and properly working ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 09-24-03, 09:28 PM
Pvasoldier Pvasoldier is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
huh?

Quote:
Originally Posted by YourPHPPro
Does your phpinfo page show that GD is installed and properly working ?

WHat is GD? does it need this to work? can i install it? cheers
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 09-24-03, 10:09 PM
YourPHPPro's Avatar
YourPHPPro YourPHPPro is offline
Community VIP
 
Join Date: Aug 2003
Posts: 430
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Pvasoldier
WHat is GD? does it need this to work? can i install it? cheers
This link should help you:

http://www.onlamp.com/pub/a/php/2003/03/27/php_gd.html
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #9 (permalink)  
Old 09-25-03, 01:39 PM
Pvasoldier Pvasoldier is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
ok

Quote:
Originally Posted by YourPHPPro
I had a look at the page and it explains what it is. Well the problem now is that the thumbnails dont appear on the page, but are created in the thumbnails directory:

www.lawsofshotgun.com/Photos/thumbnails

so i assume the gd is working correctly, just seems to be an address issue. But everything is fine as the picture appear if you click on the empty thumbnail?

its a brain teaser.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #10 (permalink)  
Old 09-25-03, 06:18 PM
Pvasoldier Pvasoldier is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
yes

Quote:
Originally Posted by Pvasoldier
I had a look at the page and it explains what it is. Well the problem now is that the thumbnails dont appear on the page, but are created in the thumbnails directory:

www.lawsofshotgun.com/Photos/thumbnails

so i assume the gd is working correctly, just seems to be an address issue. But everything is fine as the picture appear if you click on the empty thumbnail?

its a brain teaser.

THANKS SO much phppro man i got it working it was a simple address' issue and i changed it and it works thanks so muhc for your help!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for a good review management script griz_fan Script Requests 10 07-29-07 06:08 AM
photographer gallery script omini Script Requests 7 10-22-04 01:47 PM
Adding one script to another? Guestbook to gallery Pvasoldier PHP 1 09-25-03 07:02 PM
GAllery script Exodia Script Requests 5 08-28-03 04:22 AM
Script for picking the first HTML file out of a directory (with sorted HTML files) jelteveld Script Requests 0 08-16-03 02:30 PM


All times are GMT -5. The time now is 01:20 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.