mygallery mod

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
scraper
Posts: 30
Joined: Tue 9. Aug 2005, 08:01
Location: Belgium

Post by scraper »

Hey pSouper,

Thanks for your feedback.

I thought about the function_exist, but never came around to it. :oops:

With regards to the insert queries, at first sight you found the only one. just checked the main.classes.php file and the insert and update queries are OK there.
Thanks man for pointing that out :wink:

I have a new version which enables you to be able to choose the aliases you want to use for the categories used with the RT (not sure if this is making sence) :roll:

I'm glad you like it this far...
Kurt S.
Pick something up whenever you fall.
-O.Avery-
User avatar
pSouper
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London
Contact:

Post by pSouper »

thanks scraper,

your signature is not always wise words: I fell for a girl once and it took a specialist to clear up all that I picked up ;) - maybe I was just unlucky :D
User avatar
pSouper
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London
Contact:

Post by pSouper »

UPDATE (to my probs):I have not been able to work around the safe_mode issues as yet - I fear this may be the end of my mygallery_mod life :(

If this is rectified some time I would love t oknow about it and will follow this mod with interest.
macmukka

Problems after install

Post by macmukka »

Hi

I've installed the Gallery Mod in a subdirectory of www using a clean install of:-

phpwcms v1.2.6-DEV 19.11.2005

Using:-

PHP 5.05
MySQL 5.0.15

But I always get this error on the module page after clicking on Gallery Mod:-

0){ foreach ($admins as $line){ if ($line['hash']==md5($_REQUEST['mghash'])) $logged=true; } } return $logged; } function clearoldadmins($logfile, $now, $adminexpire) { include($logfile); if (count($admins)>0){ $i=0; $fp=fopen($logfile, "w"); fputs($fp, "data[$i]['id']=substr($file, 0, strpos($file, ".")); $pictures->data[$i]['pic']=$pathtoscript."images/$gal/$file"; if ($thumbnails) $pictures->data[$i]['thumb']=$pathtoscript."images/$gal/thumb_$file"; $i++; } } } if ($i>0){ $pictures->sortkeys = array(array('id','ASC')); $pictures->sort(); return $pictures->data; }else return false; } function getpictures($gal, $imgdir, $pathtoscript, $thumbnails){ $row_pict_dir=getVariable(); $dir="$imgdir$gal"; $dp=opendir($dir); $pictures= new mdasort; $i=0; while ($file=readdir($dp)){ if ($file!="." && $file!=".."){ if (strpos($file, "thumb")===false && $file!="captions.dat"){ $pictures->data[$i]['id']=substr($file, 0, strpos($file, ".")); $pictures->data[$i]['pic']=$pathtoscript.$mygaldir."$gal/$file"; if ($thumbnails) $pictures->data[$i]['thumb']=$pathtoscript.$row_pict_dir['imagedir']."$gal/thumb_$file"; $i++; } } } if ($i>0){ $pictures->sortkeys = array(array('id','ASC')); $pictures->sort(); return $pictures->data; }else return false; } function getcaps($gal, $imgdir){ $caps=false; $cappath=$imgdir.$gal."/captions.dat"; if (file_exists($cappath)){ $stuff=file($cappath); foreach ($stuff as $line){ $cap=explode("|", rtrim($line)); $caps[$cap[0]]=$cap[1]; } } return $caps; } function getcaption($gal){ $query="SELECT picture, caption FROM " . $GLOBALS['tables']['gal_caption'] . " WHERE Album = '$gal'"; $result = mysql_query($query) or die("Error: ".mysql_errno().": ".mysql_error()."
--------------------------------------------------------------------------------
" . $query); while ($row=mysql_fetch_array($result)){ $caps[$row['picture']]=$row['caption']; } return $caps; } function nltobr($str){ return str_replace(array("\n", "\r"), array("
", ""), $str); } function brtonl($str){ return str_replace("
", "\n", $str); } function isBiggerWidth($path, $size){ if ($size!==false){ $foo=getimagesize($path); if ($foo[0]>$size) return true; else return false; }else return false; } function getTemplate($tpl, $html){ $match="/<\!\-\-$tpl\-\->(.*?)<\!\-\-$tpl\-\->/s"; preg_match($match, $html, $tmp); return $tmp[1]; } function paging( $pages, $pagevar="page", $ppv=10, $first ="««« ", $firsts ="««« ", $prev ="«« ", $prevs ="«« ", $num ="{page}", $nums ="{page}", $sep =" | ", $more ="[...]", $next =" »»", $nexts =" »»", $last =" »»»", $lasts =" »»»"){ // get URI parameters $getvars=$_SERVER['PHP_SELF']."?"; foreach ($_GET as $key => $val){ if ($key!=$pagevar) $getvars.="$key=$val&"; } $page=(is_numeric($_GET[$pagevar])) ? $_GET[$pagevar] : 1; $page=($page>$pages) ? $pages : $page; $prevpage=($page>1) ? $page-1 : 1; $nextpage=($page < $pages) ? $page+1 : $pages; $paging=""; if ($pages>1){ // first $paging.=($page>1) ? str_replace("{url}", "$getvars$pagevar=1", $first) : $firsts; // prev $paging.=($page>1) ? str_replace("{url}", "$getvars$pagevar=$prevpage", $prev) : $prevs; // pages $ppvrange=ceil($page/$ppv); $start=($ppvrange-1)*$ppv; $end=($ppvrange-1)*$ppv+$ppv; $end=($end>$pages) ? $pages : $end; $paging.=($start>1) ? str_replace("{url}", "$getvars$pagevar=".($start-1), $more).$sep : ""; for ($i=1; $i<=$pages; $i++){ if ($i>$start && $i<= $end){ $paging.=($page==$i) ? str_replace("{page}", $i, $nums).(($i<$end) ? $sep : "") : str_replace(array("{url}", "{page}"), array("$getvars$pagevar=$i", $i), $num).(($i<$end) ? $sep : ""); } } $paging.=($end<$pages) ? $sep.str_replace("{url}", "$getvars$pagevar=".($end+1), $more) : "" ; // next $paging.=($page<$pages) ? str_replace("{url}", "$getvars$pagevar=$nextpage", $next) : $nexts; // last $paging.=($page<$pages) ? str_replace("{url}", "$getvars$pagevar=$pages", $last) : $lasts; } return $paging; } function getIndex(){ $sql = "SELECT id FROM " . $GLOBALS['tables']['gal_albums'] . " as albums order by id desc"; $result = mysql_query($sql) or die("Error: ".mysql_errno().": ".mysql_error()."
--------------------------------------------------------------------------------
" . $sql); $index=mysql_fetch_assoc($result); return $index['id']; } function getAlbum($album){ $sql = "SELECT * FROM " . $GLOBALS['tables']['gal_albums'] . " as albums where id='".$album."'"; $result = mysql_query($sql) or die("Error: ".mysql_errno().": ".mysql_error()."
--------------------------------------------------------------------------------
" . $sql); $index=mysql_fetch_array($result); return $index; } function getPictureCount ($album){ $sql = "SELECT pic_count FROM " . $GLOBALS['tables']['gal_albums'] . " as albums where id=$album"; $result = mysql_query($sql) or die("Error: ".mysql_errno().": ".mysql_error()."
--------------------------------------------------------------------------------
" . $sql); $index=mysql_fetch_assoc($result); if ($index) return $index['pic_count']; else return 0; } function upload_image($originalsize, $jpgquality, $thumbhv, $thumbsize, $counter, $filepath, $album){ $filepath.=$album; if (copy($_FILES['mgfile']['tmp_name'], "$filepath/$counter.jpg")){ $query = "INSERT INTO " . $GLOBALS['tables']['gal_caption'] . " (Album,picture) VALUES ('$album','$counter')"; $result = mysql_query($query) or die("Error: ".mysql_errno().": ".mysql_error()."
--------------------------------------------------------------------------------
" . $query); chmod("$filepath/$counter.jpg", 0777); if (isBiggerWidth("$filepath/$counter.jpg", $originalsize)) mkthumbnail("$filepath/$counter.jpg", "$filepath/$counter.jpg", "w", $originalsize, $jpgquality); if (true) //create thumbnails mkthumbnail("$filepath/$counter.jpg", "$filepath/thumb_$counter.jpg", $thumbhv, $thumbsize, $jpgquality); $query = "UPDATE " . $GLOBALS['tables']['gal_albums'] . " SET pic_count = '$counter' where id='$album.'"; $result = mysql_query($query) or die("Error: ".mysql_errno().": ".mysql_error()."
--------------------------------------------------------------------------------
" . $query); $check=true; } else $check=false; return $check; } function getVariable(){ $query="SELECT * FROM " . $GLOBALS['tables']['gal_config']; $result = mysql_query($query) or die("Error: ".mysql_errno().": ".mysql_error()."
--------------------------------------------------------------------------------
" . $query); $row = mysql_fetch_array($result); return $row; } function htmldecode($encoded) { return strtr($encoded,array_flip(get_html_translation_table(HTML_ENTITIES))); } ?>


Once installed I was able to create the tables in the database:-
phpwcms_gal_albums
phpwcms_gal_caption
phpwcms_gal_config

Using the setup process. But I still get the error above the mod control.

Do you know what could be wrong? I really want to get this to work, as it perfect for a site I have coming up. :D

Thanks and best - mac[/code]
scraper
Posts: 30
Joined: Tue 9. Aug 2005, 08:01
Location: Belgium

Post by scraper »

:shock:

Hi Mac,

Never saw this before. Looks to me as if he doesn't render the code.
Do you have other modules installed (like the calendar module)? Do they work correctly?

I'm not using PHP5 and mysql5 yet (boy you're up to date).
:lol:

I'll do some tests...
Anyone else an idea :?:
Kurt S.
Pick something up whenever you fall.
-O.Avery-
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Post by frold »

PHP 5.05
MySQL 5.0.15
I dont know if phpwcms support that?
http://www.studmed.dk Portal for doctors and medical students in Denmark
User avatar
pico
Posts: 2595
Joined: Wed 28. Jul 2004, 18:04
Location: Frankfurt/M Germany
Contact:

Post by pico »

Hi

looks for me like a corrupt PHP-File - this sometimes happens by uploading via FTP - or did you edit the Files with Winword or a Editor like this?

Unpack the Mod again and upload all Files again.
Lieber Gott gib mir Geduld - ABER BEEIL DICH
Horst - find me at Musiker-Board
macmukka

Post by macmukka »

thanks -

Things have got a little strange on my development machine, so I am writing this as I do a format & resintall.

But I was going to try going back a level on both php & MySQL to see if it helped. (also will try downloading packages again, but I've done this a few times now, I normally use DW MX to edit php BTW)

Cause I am stuck on a PC at the moment, I normally just use WAMP to configure Apache, PHP & MySQL as it's easier, I've used EasyPHP in the past too. Does anyone have any advice on installers like this? I've also installed the 3 of them the hard way a few times, but for my use an installer seems ok. I am more of a designer than a hard nosed PHP/SQL type!

I'll report back once I've got back up and running.

Nice to see so many people in this community have ideas!

- and yes I had the calender mod running perfectly under PHP/MYSQL 5. The banner mod wouldn't work though!? IF that helps....
scraper
Posts: 30
Joined: Tue 9. Aug 2005, 08:01
Location: Belgium

Post by scraper »

Hey Mac,

I used the callendar mod as blueprint for the gallery mod, from there my question.
We'll wait till you have everything up and running again?

To answer your question, I always install the packages seperately.
For me that's a sport :lol:

Thanks everyone for your feedback about this problem!!!
Kurt S.
Pick something up whenever you fall.
-O.Avery-
macmukka

Post by macmukka »

Okay after the normal hours of tedium reinstalling XP....

I now have a system running:

PHP5.05
MySQL 5.0.15
Apache 2
All installed using the very easy installer from the nice people at XAMMP

with, phpwcms v1.2.5-DEV

I installed the Gallery Mod, and my previous error was gone, I had a problem with fmod, but fixed that. Now when I click to install on the modules page I get this message:-

Error creating the events table: Query was empty

And no tables are added to the DB.

I feel like I am almost there!!

FTR phpwcms seems to run ok under the current XAMPP distrib.

Any other help much appreciated! thanks so far...

Mac
scraper
Posts: 30
Joined: Tue 9. Aug 2005, 08:01
Location: Belgium

Post by scraper »

Hey Mac,

If I understand you correctly, you clicked the "install Gallery mod" button and you received the error.

These are the queries that are executed when you click on the install button:

Code: Select all

$create_albums_sql = "
CREATE TABLE `" . $GLOBALS['tables']['gal_albums']  . "` (
  `id` int(11) unsigned NOT NULL default '0',
  `album_order` int(11) NOT NULL default '0',
  `title` varchar(150) NOT NULL default '',
  `description` text,
  `pic_count` int(11) NOT NULL default '0',
  PRIMARY KEY  (`id`)
)";

$create_caption_sql = "
CREATE TABLE `" . $GLOBALS['tables']['gal_caption'] . "` (
  `id` int(11) NOT NULL auto_increment,
  `Album` int(11) NOT NULL default '0',
  `picture` int(11) NOT NULL default '0',
  `caption` text,
  PRIMARY KEY  (`id`)
)";

$create_config_sql = "
CREATE TABLE `" . $GLOBALS['tables']['gal_config'] . "` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `slideshow` text,
  `slideshow_time` int(2) default NULL,
  `thumbnails` text,
  `originalsize` text,
  `thumbsize` int(11) default NULL,
  `thumbhv` char(2) binary default 'w',
  `thumbcols` int(2) default NULL,
  `pathtoscript` text,
  `imagedir` text,
  `jpgquality` int(2) default '85',
  `gpp` int(2) default NULL,
  PRIMARY KEY  (`id`)
)";

$config = "INSERT INTO `" . $GLOBALS['tables']['gal_config'] . "` VALUES ('1','true','3','true','400','120','w','4','include/inc_module/mygallery/','images/','85','4')";
Can you execute the queries directly in mysql?
It says that the query to create the album table is empty :?: The fact that it reports events table is my fault :oops: bad coding.
I've updated this in the zip file.

The reason why the query is empty could be because the config.php file can not be included. But you should get a warning then. :roll:
Kurt S.
Pick something up whenever you fall.
-O.Avery-
macmukka

Post by macmukka »

scraper

Superb! I have added the tables and values manually and it seems to work!

I havent got the time to play with it too much tonight! But tomorrow is another day....

Thank you so much for this. I needed the gallery for an upcoming project.

If I can be of help to you please get in touch....(doubtful!)

Thanks - Mac
macmukka

Post by macmukka »

scraper

thanks for the help with the gallery mod, it's now installed and working.

I am just having trouble using it, when I have albums on screen I get on mouseover:-

http://localhost/index.php?gallery&album=2

when it should be:-

http://localhost/index.php?mygal&album=2?

I think this has been covered before in a post, but I dont understand. How do I solve this problem, I think I have built the gallery, album and picture structure wrongly is there any way you could help explain a bit more?

Thanks and best - mac
TMerz
Posts: 47
Joined: Wed 3. Nov 2004, 13:56
Location: Herxheim/Deutschland

MyGallery: SafeMode problem - any idea or help???

Post by TMerz »

Hi, all
Hi, scraper!

Great module, that´s what we needed! :lol:

My test-installation was quite simple and everything seemed to be OK. But at least, I can´t create a new album because of the following problem:

Warning: copy(): SAFE MODE Restriction in effect. The script whose uid is 1270 is not allowed to access /var/www/web71/html/phpwcms125/include/inc_module/mygallery/images/1 owned by uid 33 in /var/www/web71/html/phpwcms125/include/inc_module/mygallery/inc_lib/main.functions.php on line 252

Warning: copy(/var/www/web71/html/phpwcms125/include/inc_module/mygallery/images/1/1.jpg): failed to open stream: No such file or directory in /var/www/web71/html/phpwcms125/include/inc_module/mygallery/inc_lib/main.functions.php on line 252
folder created but image not saved to disk


Is there a possibility to solve this??? :?:
Or is this the "end" for MyGallery for me? :cry:

Thanks for Your support,
TMerz
prisma
Posts: 39
Joined: Sun 12. Dec 2004, 18:19
Location: CH-Sils im Domleschg

i have the same problem

Post by prisma »

Hallo TMerz,

ich habe das gleiche Problem.
Warning: mysql_query(): Access denied for user: 'apache@localhost' (Using password: NO) in /home/httpd/vhosts/xxx/httpdocs/include/inc_module/mygallery/install/install.php on line 6

Warning: mysql_query(): A link to the server could not be established in /home/httpd/vhosts/xxx/httpdocs/include/inc_module/mygallery/install/install.php on line 6
Error creating the events table: Access denied for user: 'apache@localhost' (Using password: NO) CREATE TABLE `phpwcms_gal_albums` ( `id` int(11) unsigned NOT NULL default '0', `album_order` int(11) NOT NULL default '0', `title` varchar(150) NOT NULL default '', `description` text, `pic_count` int(11) NOT NULL default '0', PRIMARY KEY (`id`) )

Gruss prisma
Post Reply