Jump to content


Random IP.Gallery Block


16 replies to this topic

#1 BudmannG

  • Members
  • 14 posts
  • Location:USA
  • Illinois

Posted 29 January 2007 - 09:50 PM

Hi Visible,

I am trying to link a random pic block to my forum gallery. I have some code that was posted on another forum for the last five pics in the forum view.
Now mind you I am no coder. I have tried to make this thing work. I have also looked at the code in mkportal gallery block. I have no clue what I am doing, could you please give me some insite as to where I should start.
I have dreamweaver to edit with. I have tried to do this on my own. I have also posted on the mkportal forums about it. They told me to look at the codes I have already mentioned to you. I have been trying to get it for the last four days and no success.

Thanks for your time.

-----------
EDIT by visiblesoul: edited topic title
Thanks, Bud!
Midwest Illinois DSM.com

I'll try to be nicer, If you try to be smarter!

#2 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 29 January 2007 - 10:15 PM

BudmannG said:

Hi Visible,

I am trying to link a random pic block to my forum gallery. I have some code that was posted on another forum for the last five pics in the forum view.
Now mind you I am no coder. I have tried to make this thing work. I have also looked at the code in mkportal gallery block. I have no clue what I am doing, could you please give me some insite as to where I should start.
I have dreamweaver to edit with. I have tried to do this on my own. I have also posted on the mkportal forums about it. They told me to look at the codes I have already mentioned to you. I have been trying to get it for the last four days and no success.

Thanks for your time.
Hello BudmannG-

I am not completely clear about what you want to do.

Do you want to display images from the MKPortal Gallery, IP.Gallery, Coppermine, Gallery2 or some other gallery?

-=DKC=-


Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#3 BudmannG

  • Members
  • 14 posts
  • Location:USA
  • Illinois

Posted 29 January 2007 - 10:21 PM

Ip Gallery I think? I am running ipb2.2 boards. I was wanting the random pic to show from my forums gallery instead of the mkportal gallery.
Thanks, Bud!
Midwest Illinois DSM.com

I'll try to be nicer, If you try to be smarter!

#4 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 30 January 2007 - 02:02 AM

BudmannG said:

Ip Gallery I think? I am running ipb2.2 boards. I was wanting the random pic to show from my forums gallery instead of the mkportal gallery.
There is an old IP.Gallery block available for download on mkportal.it. But I don't know if it will work with the current version of IP.Gallery or not.

http://www.mkportal.it/index.php?ind=downl...y_view&iden=282

I will be coding a Subdreamer block for IP.Gallery tomorrow so I will try to port it to MKPortal if I get a chance. I am stretched a little thin this week.

-=DKC=-


Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#5 BudmannG

  • Members
  • 14 posts
  • Location:USA
  • Illinois

Posted 30 January 2007 - 06:43 AM

Man you are a saint!
Thanks, Bud!
Midwest Illinois DSM.com

I'll try to be nicer, If you try to be smarter!

#6 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 30 January 2007 - 10:28 AM

Before I do the work, have you tried using the existing IP.Gallery block (link posted above) to see if it works?


Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#7 BudmannG

  • Members
  • 14 posts
  • Location:USA
  • Illinois

Posted 30 January 2007 - 10:35 AM

Yeah I just got done trying it out. It will link the picture name but no pictures show up. But it does work part of the way, and that is more than I got out of it. LOL.
Thanks, Bud!
Midwest Illinois DSM.com

I'll try to be nicer, If you try to be smarter!

#8 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 02 February 2007 - 05:30 PM

BudmannG said:

Yeah I just got done trying it out. It will link the picture name but no pictures show up. But it does work part of the way, and that is more than I got out of it. LOL.
Oh OK, I know why the images do not show up. IP.Gallery uses multiple image subdirectory names but the MKPortal block does not get the directory name from the database.

I'm almost finished with my Subdreamer block for IP.Gallery so soon I will make one for MKPortal. But it will probably take a few more days.


Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#9 BudmannG

  • Members
  • 14 posts
  • Location:USA
  • Illinois

Posted 04 February 2007 - 01:56 PM

WOOHOOOO!

I figured most of it out. I have added to the code that you wrote in random_ips_gallery.php. I had to add the directory in with the url. I don't want to get in trouble for posting the code here. If I won't get in trouble I will show you the changes.

I did add an extra line in it to show how many views the picture has had. But once I got the picture to work it went away and I don't know if it is because of the size of the block in MKPortal or what.

But I got it to work!!!!!

Let me know about posting the code. Because I could use the help to get the # of views back up in there.

Thanks for all your help!
Thanks, Bud!
Midwest Illinois DSM.com

I'll try to be nicer, If you try to be smarter!

#10 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 05 February 2007 - 07:31 AM

BudmannG said:

WOOHOOOO!

I figured most of it out. I have added to the code that you wrote in random_ips_gallery.php. I had to add the directory in with the url. I don't want to get in trouble for posting the code here. If I won't get in trouble I will show you the changes.

I did add an extra line in it to show how many views the picture has had. But once I got the picture to work it went away and I don't know if it is because of the size of the block in MKPortal or what.

But I got it to work!!!!!

Let me know about posting the code. Because I could use the help to get the # of views back up in there.

Thanks for all your help!
Sure post code if you like. But please post code snippets and not huge blocks of code. That makes my eyes glaze over. :)


Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#11 BudmannG

  • Members
  • 14 posts
  • Location:USA
  • Illinois

Posted 05 February 2007 - 10:37 AM

Here is the first part of the code.
$content = "";


	   $query = $DB->query("SELECT id FROM ibf_gallery_images");
	   $count = $DB->get_num_rows ($query);
	   $start  =	   rand(0, ($count -1));
	   $query = $DB->query("SELECT id, directory, views, caption as titolo, masked_file_name as file FROM ibf_gallery_images where approved = '1' LIMIT $start, 1");
	   $foto = $DB->fetch_row($query);
	   $id = $foto['id'];
	   $titolo = $foto['titolo'];
	   $file = $foto['file'];
	   $thumb = "tn_$file";
	   $directory = $foto['directory'];
	   $views = $foto['views'];
Here is the second.
if (!file_exists("$this->sitepath/forum/uploads/$directory/$thumb")) {
			   $thumb_mes = $this->ResizeImage(120,"$this->sitepath/mkportal/modules/gallery/album/$file");
			   $content = "<td align="center"><a href="$this->siteurl/forum/index.php?act=module&module=gallery&cmd=si&img=$id"><img src="$this->siteurl/forum/uploads/$directory/$file" border="0"  width='$thumb_mes[0]' height='$thumb_mes[1]'  alt="{$this->lang['gallery_zoom']}"></a></td></tr>
			   <tr><td id="tdblock" align="center">$titolo
</td></tr>
			   <tr><td id="tdblock" align="center">$views Views
</td></tr>";
	   } else {
			   $content = "<td align="center"><a href="$this->siteurl/forum/index.php?act=module&module=gallery&cmd=si&img=$id"><img src="$this->siteurl/forum/uploads/$directory/$thumb" border="0" alt="{$this->lang['gallery_zoom']}"></a></td></tr>
			   <tr><td id="tdblock" align="center">$titolo
</td></tr>";
	   }
I left out the code that is between the second and third part. As I didn't have to change it. But here is the third part.
unset($query);
	   unset($count);
	   unset($start);
	   unset($foto);
	   unset($id);
	   unset($titolo);
	   unset($file);
	   unset($thumb);
	   unset($views);
	   unset($directory);

Thanks, Bud!
Midwest Illinois DSM.com

I'll try to be nicer, If you try to be smarter!

#12 BudmannG

  • Members
  • 14 posts
  • Location:USA
  • Illinois

Posted 07 February 2007 - 07:48 PM

Hi Visible,

I finally got it all to work right. Will you post it back up on MKPortal as an updated mod for the portal? I think that most would use this alot as I am very happy with it now. Thank you for all your help on this, I know you are busy at the moment. That is why I worked on it myself.

<?
/*
+--------------------------------------------------------------------------
|   MKportal Random IPS Gallery Pic 20.01.2005
|   for MKP x IPB2
|   by mr_zaz
|   based on MkPortal random_pic.php by Meo <mkportal.it>
+---------------------------------------------------------------------------
|
|   > MKPortal
|   > Written By Amedeo de longis
|   > Date started: 9.2.2004
|
+--------------------------------------------------------------------------
*/
$content = "";


	   $query = $DB->query("SELECT id FROM ibf_gallery_images");
	   $count = $DB->get_num_rows ($query);
	   $start  =	   rand(0, ($count -1));
	   $query = $DB->query("SELECT id, directory, views, caption as titolo, masked_file_name as file FROM ibf_gallery_images where approved = '1' LIMIT $start, 1");
	   $foto = $DB->fetch_row($query);
	   $id = $foto['id'];
	   $titolo = $foto['titolo'];
	   $file = $foto['file'];
	   $thumb = "tn_$file";
	   $directory = $foto['directory'];
	   $views = $foto['views'];

	   if (!file_exists("$this->sitepath/forum/uploads/$directory/$thumb")) {
			   $thumb_mes = $this->ResizeImage(120,"$this->sitepath/mkportal/modules/gallery/album/$file");
			   $content = "<td align="center"><a href="$this->siteurl/forum/index.php?act=module&module=gallery&cmd=si&img=$id"><img src="$this->siteurl/forum/uploads/$directory/$file" border="0"  width='$thumb_mes[0]' height='$thumb_mes[1]'  alt="{$this->lang['gallery_zoom']}"></a></td></tr>
			   <tr><td id="tdblock" align="center">$titolo
</td></tr>
			   <tr><td id="tdblock" align="center">$views Views
</td></tr>";
	   } else {
			   $content = "<td align="center"><a href="$this->siteurl/forum/index.php?act=module&module=gallery&cmd=si&img=$id"><img src="$this->siteurl/forum/uploads/$directory/$thumb" border="0" alt="{$this->lang['gallery_zoom']}"></a></td></tr>
			   <tr><td id="tdblock" align="center">$titolo
</td></tr>
			   <tr><td id="tdblock" align="center">$views Views
</td></tr>";
	   }

	   if(!$id) {
					   $content = "<tr>
					   <td id="tdblock" align="center">
					   {$this->lang['no_galleryim']}
					   </td>
					   </tr>
					   ";
	   }

	   if(!$mkportals->member['g_access_cp'] && !$this->member['g_access_gallery']) {
					   $content = "<tr>
					   <td id="tdblock" align="center">
					   {$this->lang['gallery_noallow']}
					   </td>
					   </tr>
					   ";
	   }

	   unset($query);
	   unset($count);
	   unset($start);
	   unset($foto);
	   unset($id);
	   unset($titolo);
	   unset($file);
	   unset($thumb);
	   unset($views);
	   unset($directory);
?>
Well there it is complete. I hope to see it on MKPortal soon as a update. Thanks again.

Here is a screen shot of it in action.
Posted Image
Thanks, Bud!
Midwest Illinois DSM.com

I'll try to be nicer, If you try to be smarter!

#13 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 08 February 2007 - 08:30 AM

BudmannG said:

Hi Visible,

I finally got it all to work right. Will you post it back up on MKPortal as an updated mod for the portal? I think that most would use this alot as I am very happy with it now. Thank you for all your help on this, I know you are busy at the moment. That is why I worked on it myself.

<?
/*
+--------------------------------------------------------------------------
|   MKportal Random IPS Gallery Pic 20.01.2005
|   for MKP x IPB2
|   by mr_zaz
|   based on MkPortal random_pic.php by Meo <mkportal.it>
+---------------------------------------------------------------------------
|
|   > MKPortal
|   > Written By Amedeo de longis
|   > Date started: 9.2.2004
|
+--------------------------------------------------------------------------
*/
$content = "";


	   $query = $DB->query("SELECT id FROM ibf_gallery_images");
	   $count = $DB->get_num_rows ($query);
	   $start  =	   rand(0, ($count -1));
	   $query = $DB->query("SELECT id, directory, views, caption as titolo, masked_file_name as file FROM ibf_gallery_images where approved = '1' LIMIT $start, 1");
	   $foto = $DB->fetch_row($query);
	   $id = $foto['id'];
	   $titolo = $foto['titolo'];
	   $file = $foto['file'];
	   $thumb = "tn_$file";
	   $directory = $foto['directory'];
	   $views = $foto['views'];

	   if (!file_exists("$this->sitepath/forum/uploads/$directory/$thumb")) {
			   $thumb_mes = $this->ResizeImage(120,"$this->sitepath/mkportal/modules/gallery/album/$file");
			   $content = "<td align="center"><a href="$this->siteurl/forum/index.php?act=module&module=gallery&cmd=si&img=$id"><img src="$this->siteurl/forum/uploads/$directory/$file" border="0"  width='$thumb_mes[0]' height='$thumb_mes[1]'  alt="{$this->lang['gallery_zoom']}"></a></td></tr>
			   <tr><td id="tdblock" align="center">$titolo
</td></tr>
			   <tr><td id="tdblock" align="center">$views Views
</td></tr>";
	   } else {
			   $content = "<td align="center"><a href="$this->siteurl/forum/index.php?act=module&module=gallery&cmd=si&img=$id"><img src="$this->siteurl/forum/uploads/$directory/$thumb" border="0" alt="{$this->lang['gallery_zoom']}"></a></td></tr>
			   <tr><td id="tdblock" align="center">$titolo
</td></tr>
			   <tr><td id="tdblock" align="center">$views Views
</td></tr>";
	   }

	   if(!$id) {
					   $content = "<tr>
					   <td id="tdblock" align="center">
					   {$this->lang['no_galleryim']}
					   </td>
					   </tr>
					   ";
	   }

	   if(!$mkportals->member['g_access_cp'] && !$this->member['g_access_gallery']) {
					   $content = "<tr>
					   <td id="tdblock" align="center">
					   {$this->lang['gallery_noallow']}
					   </td>
					   </tr>
					   ";
	   }

	   unset($query);
	   unset($count);
	   unset($start);
	   unset($foto);
	   unset($id);
	   unset($titolo);
	   unset($file);
	   unset($thumb);
	   unset($views);
	   unset($directory);
?>
Well there it is complete. I hope to see it on MKPortal soon as a update. Thanks again.

Here is a screen shot of it in action.
http://img144.images...nshot005ck3.gif
Nice work. I want to add your credits to the block before I upload it. How do you want your credit line to read?.

-=DKC=-


Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#14 BudmannG

  • Members
  • 14 posts
  • Location:USA
  • Illinois

Posted 08 February 2007 - 10:18 AM

Thank you for the honor. I have never done my own credits before. Could you give me an example please. Thanks again Visible!
Thanks, Bud!
Midwest Illinois DSM.com

I'll try to be nicer, If you try to be smarter!

#15 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 09 February 2007 - 07:10 AM

BudmannG said:

Thank you for the honor. I have never done my own credits before. Could you give me an example please. Thanks again Visible!
Well if I had updated the block I would do something like this...

Quote

+--------------------------------------------------------------------------
| MKportal Random IP.Gallery Image 2.0 09.02.2007
| for MKPortal x IPB2
| by visiblesoul
| based on MkPortal random_pic.php by Meo
| and Random IPS Gallery Pic by mr_zaz
+---------------------------------------------------------------------------
or this...

Quote

+--------------------------------------------------------------------------
| MKportal Random IPS Gallery 2.0 09.02.2007
| for MKP x IPB2
| by mr_zaz
| based on MkPortal random_pic.php by Meo
| updated for IP.Gallery version 2.1.x by visiblesoul
+---------------------------------------------------------------------------



Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#16 BudmannG

  • Members
  • 14 posts
  • Location:USA
  • Illinois

Posted 09 February 2007 - 08:28 AM

+--------------------------------------------------------------------------
| MKportal Random IP.Gallery Image 2.0 09.02.2007
| for MKPortal x IPB2.2
| by BudmannG
| based on MkPortal random_pic.php by Meo
| and Random IPS Gallery Pic by mr_zaz
+---------------------------------------------------------------------------

This way looks good to me. It felt good to accomplish this on my own. The latest post one is going to be a bit harder.

Thanks again Visible!
Thanks, Bud!
Midwest Illinois DSM.com

I'll try to be nicer, If you try to be smarter!

#17 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 09 February 2007 - 09:32 AM

BudmannG said:

+--------------------------------------------------------------------------
| MKportal Random IP.Gallery Image 2.0 09.02.2007
| for MKPortal x IPB2.2
| by BudmannG
| based on MkPortal random_pic.php by Meo
| and Random IPS Gallery Pic by mr_zaz
+---------------------------------------------------------------------------

This way looks good to me. It felt good to accomplish this on my own. The latest post one is going to be a bit harder.

Thanks again Visible!
OK, I'll try to put this together and upload it later today. :)

---------------------------------------
EDIT: I uploaded the block here...

http://www.mkportal.it/index.php?ind=downl...y_view&iden=791

I would also like permission to add the block to my own downloads section here..

http://www.visibleso...rces/downloads/

Thanks.
-=DKC=-


Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users