I have my egallery working just fine! I now started to have this small problem. my gallery is getting really big (lots of users sends lots of images). on upload, my_egallery should check if the filename/medianame already exsists in the database and if so ask the user to change the media name.
my_egallery faild this proccess and I keep on overwrithing exsisting images.
the problem in my opinion is in the uploadFile.php under the function Add:
Code:
function Add($gid, $file, $submitter, $medianame, $description, $userfile, $userfile_name, $userfile_size) {
global
$user,
$font,
$galleryvar,
$basepath,
$temppath,
$prefix
;
$sql = "select img from $prefix"._gallery_pictures." where gid=$gid and img='$file'";
//echo $sql;
$result = mysql_query($sql);
$numrows = mysql_num_rows($result);
$navgall = navigationGall();
take a look at this part that should check if media name exsist:
Code:
// Check if Media Name exist
if (!isset($medianame) || $medianame=="") {
galleryHeader();
echo "<br>";
OpenTable();
print '<table border="0" width="100%" align="center" cellpadding="0">'
.'<tr><td>'.$navgall;
echo "<br>";
echo "<center><b>"._GALPICNONAME."</b><br><br>"
.""._GOBACK."";
print '</td></tr></table>';
CloseTable();
galleryFooter();
}
As I was trying to solve this I found out my_egallery has 2 id's for file/media name in the database: table 'img' which is the real file name (ex. 1.jpg) and table 'name' which is the name the user give to the image (ex. nice flower).
for some unknown reason the coder who wrote this gallery is trying to check if the 'name' is already exsist in the database and not 'img' which is much more logical and what it should really check in order to prevent duplicated images and file names.
After playing with the code for hours now (I think it should really be simple to replace the checking to file name instad of user file name I gusse I just too dumm) I just gave up.
Does anyone have any idea on how to change the checking to file name?
I'm guessing its querying on "gallery_pictures" table and its failing? If the query is failing, you'd probably be able to capture this error and deal with it so it doesn't execute the more code
What I would try is setting indexes on that table to speed up searching, esp if its only based on one field like the image name
View next topic View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum