hmmm can some1 test my gallery at blog.net-kid.net/preupload.pcgi ?
i think something is wrong,
btw .pcgi is the xtension for my host so i can use GD or ImageMagick
| SitePoint Sponsor |



hmmm can some1 test my gallery at blog.net-kid.net/preupload.pcgi ?
i think something is wrong,
btw .pcgi is the xtension for my host so i can use GD or ImageMagick
Santosh Sankar
Bullish Bankers
I got:Originally Posted by netkid
----------------------------------------------------------------------
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@blog.net-kid.net and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
----------------------------------------------------------------------
also, you might want to put an index.html in your photogallery folder and link to the viewgallery.pcgi. I can see all your files!
I clicked on the "My First Gallery" link and it never displayed. Something is bad wrong. Does your host not have GD installed? If so, why not use the code I provided a few posts ago?


i use this gallery software.. it's really very good stuff.. lots of features etc.. great software.. and they are coming out with a 2.0 soon that's going to be even better.Originally Posted by Anonymous
![]()
nice one animal...
that was just what i was looking for!
i'll have a go at doing that this afternoon and if it still doesn't work i'll probably be back here!!!




Ok I'm working on my back end to this now and I'm trying to delete the photos from the database but when the script uploads the image its setting the owner and user of the file as something different so I dont have permisson to delete or change perms on thoes files.
Is their a way of including the permissions and user.group perms that the uploaded files should have or should I work out a way on the system to force the perms and uid.gid of the uploaded files???
Below is my delete function.
Thanks for any helpPHP Code:// Delete a picture from the database
if(isset($_REQUEST['delete_photo'])) {
$photo_id = $_REQUEST['delete_photo'];
$cid = $_REQUEST['cid'];
if($photo_id != "" && $cid != "") {
delete_photo($photo_id);
$result_final .= "<br/><p style='color: green; font-weight: bold;'>Photo ID: $photo_id has been deleted from the database.</p>";
} else {
$result_final .= "<br /><p style='color: red; font-weight: bold;'>Their was an error in deleting the requested image please go back and try again.</p>";
}
}



Hi
This is a great tutorial. I have been running an image library with cgi and perl scripts with limited functionality but this one is so much better.
I have got heaps of it working thanks to the tutorial and the messages left here but I am having troubles with the image maintenance page.
I want to add a delete an image option and preferably an edit and move image option.
I'm pretty new at php but am getting to know my way around.
Has anyone got this working and if so can you PLEASE post your working code.
Many Thanks
M Barnes
Great Article! One problem for me though:
I really need to be able to use .gif's on upload. My ISP has PHP and GD library set so that it will "read" gif's but not write them. In another php program I'm using they get around the gif issue by having the program "ignore" gif's for the creation of thumbnails (only uses gd to create .jpeg and .png thumbs). Thus the thumbnail file reference for .gif's is set to the same image file name as the full-size image. Even though this is a slightly larger file to work with, it does allow one to use the existing .gif without having to force GD to "write" .gif's to the server (by way of patches or using older versions of the software, etc.).
Can you possibly suggest a mod to your upload.php script as would allow this same functionality? (making the program "ignore" .gif's for thumbnail creation while using the full file reference for display purposes)?
Many thanks!
spin



My gallery works fine but wen u click on a gallery to see it, it never loads....
http://www.blog.net-kid.net/photogal...ewgallery.pcgi
BTW on my server to use GD ur extension is pcgi
Santosh Sankar
Bullish Bankers


It looks like that your gellery is in a constent loop. You might have told the
script to go to the same page again and again. - Probably using Header(), check again.
It tries to go to: 66.33.199.37 again and again.
- Danny



so wut do i?
Santosh Sankar
Bullish Bankers


Add the code to your post and I will try to help you.
- Danny



ok, im at school right now, I'll paste it in from home
Santosh Sankar
Bullish Bankers



You can visit the view page at:
http://blog.net-kid.net/photogallery/viewgallery.pcgi
pcgi xtension is due to my server config
Code:
PHP Code:
<?php
include("config.inc.php");
// initialization
$result_array = array();
$counter = 0;
$cid = (int)($_GET['cid']);
$pid = (int)($_GET['pid']);
// Category Listing
if( empty($cid) && empty($pid) )
{
$number_of_categories_in_row = 4;
$result = mysql_query( "SELECT c.category_id,c.category_name,COUNT(photo_id)
FROM gallery_category as c
LEFT JOIN gallery_photos as p ON p.photo_category = c.category_id
GROUP BY c.category_id" );
while( $row = mysql_fetch_array( $result ) )
{
$result_array[] = "<a href='viewgallery.php?cid=".$row[0]."'>".$row[1]."</a> "."(".$row[2].")";
}
mysql_free_result( $result );
$result_final = "<tr>\n";
foreach($result_array as $category_link)
{
if($counter == $number_of_categories_in_row)
{
$counter = 1;
$result_final .= "\n</tr>\n<tr>\n";
}
else
$counter++;
$result_final .= "\t<td>".$category_link."</td>\n";
}
if($counter)
{
if($number_of_categories_in_row-$counter)
$result_final .= "\t<td colspan='".($number_of_categories_in_row-$counter)."'> </td>\n";
$result_final .= "</tr>";
}
}
// Listing
else if( $cid && empty( $pid ) )
{
$number_of_thumbs_in_row = 5;
$result = mysql_query( "SELECT photo_id,photo_caption,photo_filename FROM gallery_photos WHERE photo_category='".addslashes($cid)."'" );
$nr = mysql_num_rows( $result );
if( empty( $nr ) )
{
$result_final = "\t<tr><td>No Category found</td></tr>\n";
}
else
{
while( $row = mysql_fetch_array( $result ) )
{
$result_array[] = "<a href='viewgallery.php?cid=$cid&pid=".$row[0]."'><img src='".$images_dir."/tb_".$row[2]."' border='0' alt='".$row[1]."' /></a>";
}
mysql_free_result( $result );
$result_final = "<tr>\n";
foreach($result_array as $thumbnail_link)
{
if($counter == $number_of_thumbs_in_row)
{
$counter = 1;
$result_final .= "\n</tr>\n<tr>\n";
}
else
$counter++;
$result_final .= "\t<td>".$thumbnail_link."</td>\n";
}
if($counter)
{
if($number_of_photos_in_row-$counter)
$result_final .= "\t<td colspan='".($number_of_photos_in_row-$counter)."'> </td>\n";
$result_final .= "</tr>";
}
}
}
// Full Size View of Photo
else if( $pid )
{
$result = mysql_query( "SELECT photo_caption,photo_filename FROM gallery_photos WHERE photo_id='".addslashes($pid)."'" );
list($photo_caption, $photo_filename) = mysql_fetch_array( $result );
$nr = mysql_num_rows( $result );
mysql_free_result( $result );
if( empty( $nr ) )
{
$result_final = "\t<tr><td>No Photo found</td></tr>\n";
}
else
{
$result = mysql_query( "SELECT category_name FROM gallery_category WHERE category_id='".addslashes($cid)."'" );
list($category_name) = mysql_fetch_array( $result );
mysql_free_result( $result );
$result_final .= "<tr>\n\t<td>
<a href='viewgallery.php'>Categories</a> >
<a href='viewgallery.php?cid=$cid'>$category_name</a></td>\n</tr>\n";
$result_final .= "<tr>\n\t<td align='center'>
<br />
<img src='".$images_dir."/".$photo_filename."' border='0' alt='".$photo_caption."' />
<br />
$photo_caption
</td>
</tr>";
}
}
// Final Output
echo <<<__HTML_END
<html>
<head>
<title>Gallery View</title>
</head>
<body>
<table width='100%' border='0' align='center' style='width: 100%;'>
$result_final
</table>
</body>
</html>
__HTML_END;
?>
Santosh Sankar
Bullish Bankers



?
Santosh Sankar
Bullish Bankers
It has to be your server config. Your code runs fine on my server here:Originally Posted by netkid
http://www.anglersforchrist.com/gallery/new.php
I changed the name of the file and the name inside the code. Other than that, this is your code exactly.
**update **
I just looked at your site again and I got this to pull up:
http://blog.net-kid.net/photogallery...ery.pcgi?cid=1
http://blog.net-kid.net/photogallery...i?cid=1&pid=15
it is "kinda working". Change the links to viewgallery.php in your code to viewgallery.pcgi and I think that will sovle your problem. You also need to look at how your 404 error document is setup in your htaccess file. That is not working right. Here is mine if it will help:
ErrorDocument 404 http://www.anglersforchrist.com/404.html
P.S. I see you take Tae Kwon Do. I have a black belt in TKD (first Dan)



Ok...which code though?
Yea I just got my black belt in TKD about 3 wks ago
Santosh Sankar
Bullish Bankers
you posted this code... see the link to viewgallery.php? your file is not named that. change every instance to .php with .pcgi .Originally Posted by netkid



ok thanks
Santosh Sankar
Bullish Bankers



I have a question, how do I get rid of the the Test Gallery and How do I add a new gallery?
Santosh Sankar
Bullish Bankers
Is there a way to make the photo upload optional? I have good reason for this. I want the upload form with the option to upload and not make it puke if it doesn't have an image
Why not use javascript for validation on the fields?Originally Posted by Anonymous
http://javascript.about.com/library/...rmvalidate.htm
Hi,
This tutorial is great, easy to follow and i got it working first time. I am a newB to PHP and it’s nice to find something that is both well explained and that acutely worked without having to spend hours debugging.
Q. How can I get the photo_caption to display with the Thumbnail Listing?
Hope you can help!
Hi,
This tutorial is great, easy to follow and i got it working first time. I am a newB to PHP and it’s nice to find something that is both well explained and that acutely worked without having to spend hours debugging.
Q. How can I get the photo_caption to display with the Thumbnail Listing?
Hope you can help!
Bookmarks