collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 920
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Welcome to SimplePortal.net! You can download SimplePortal from the Downloads Area!

Author Topic: Gallery Block Aeva Vs. SMF Gallery Pro  (Read 4790 times)

0 Members and 1 Guest are viewing this topic.

Offline VegasJay

  • Semi Newbie
  • *
  • Posts: 10
  • Gender: Male
  • Operating several SMF systems, I have no life
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Gallery Block Aeva Vs. SMF Gallery Pro
« on: May 21, 2010, 04:47:23 PM »
I was using 2.3.2 and did the upgrade to 2.3.2.

Prior to the upgrade the Gallery block displayed images from my SMF Pro Gallery, after the upgrade it displays images from Aeva Media Gallery.

The converter supplied for copying images from SMF Gallery Pro does not work, and cannot get any support on making it work, for this and other reasons I am choosing to keep both Aeva and SMF Gallery Pro on my systems.

I am looking for help in creating a custom block that will display the contents of the SMF Gallery Pro as it used to when I was using Simple Portal 2.3.1, actually I intend to have two blocks one for Aeva and one for SMF Gallery Pro.

I checked the Simplemachines site for help but was scolded and told that there was help here on the Simple Portal site, however no link to where I might find the fix.

I have spent a day or more searching here and cannot seem to find the answer, does anyone have the code to display images from SMF Gallery Pro in a custom PHP block ?

Thanks in advance

JayR

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Gallery Block Aeva Vs. SMF Gallery Pro
« Reply #1 on: May 24, 2010, 11:51:54 AM »
The sp_gallery block was created with assumption that you would have only one gallery installed at a time.
The latest version checks for Aeva_media first. So that's what you get.
 
If you only ever want to display the SMF gallery, you could do a little rearranging in PortalBlocks.php.
If you ever decide to uninstall the SMF gallery, then it will be able to use the Aeva-Media gallery instead.
Code: (find) [Select]
if (!isset($mod))
 {
  if (file_exists($sourcedir . '/Aeva-Media.php'))
   $mod = 'aeva_media';
  elseif (file_exists($sourcedir . '/MGallery.php'))
   $mod = 'smf_media_gallery';
  elseif (file_exists($sourcedir . '/Gallery.php') || file_exists($sourcedir . '/Gallery2.php'))
   $mod = 'smf_gallery';
  else
   $mod = '';
 }
Code: (replace) [Select]
if (!isset($mod))
 {
  if (file_exists($sourcedir . '/Gallery.php') || file_exists($sourcedir . '/Gallery2.php'))
   $mod = 'smf_gallery';
  elseif (file_exists($sourcedir . '/Aeva-Media.php'))
   $mod = 'aeva_media';
  elseif (file_exists($sourcedir . '/MGallery.php'))
   $mod = 'smf_media_gallery';
  else
   $mod = '';
 }
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline VegasJay

  • Semi Newbie
  • *
  • Posts: 10
  • Gender: Male
  • Operating several SMF systems, I have no life
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Gallery Block Aeva Vs. SMF Gallery Pro
« Reply #2 on: May 24, 2010, 05:36:24 PM »
I apologize for not getting back here sooner, I continued to search and found a post that had what I needed, basically with minor tweaking I installed it as a custom block on the right hand side and it got my gallery back. Am currently using the default gallery block to display a few random Avea thumbnails, and the custom block to display 6 or so random images from SMF Pro, makes a nice ever changing portal page.

I made a few tweaks to fit my particular circumstances

Code: [Select]
////////////////////////////////////////////////////
// SMF Gallery Random Picture - ver. 1.7.1        //
////////////////////////////////////////////////////
//
// Developed by Thurnok
// Thurnok -AT- tinyportal .DOT. net
// November 30, 2006
//
// Updated 5/9/2007
// 1.7.1
//      - quick fix to parsing the url
//
// Updated 5/9/2007
// 1.7
//      - added option to view pics that members on your buddy list posted
//
// For list of all previous updates history, see the UPDATES.TXT attached file
// in the post where you got this code, or the .ZIP file if you downloaded it
//
// Used in a TinyPortal phpblock or Article.
// This block displays random picture(s) from
// the SMF Gallery mod along with other information
//
//////////////////////////////////////////////

global $scripturl, $db_prefix, $modSettings, $boardurl, $id_member, $user_info, $context;

/*
****************************************
****************************************
***    !! Admin Config Section !!    ***
****************************************
****************************************
*/

//   *****   LAYOUT OPTIONS   *****
// how many pictures do you want to show?  0 = all!
$gal_numpics = 8;

// use random, or most recent pics?
// 0 = random, 1 = most recent, 2 = most viewed, 3 = most commented
$gal_showtype = 0;
// sort :: 0 = Descending, 1 = Ascending
$gal_sort = 0;

// enable profile pics display?
// 0 = disable, 1 = enable --- if enabled, and you are viewing a member profile, show pics from that member only
// other options still apply (showtype, sort order, etc)
$gal_profile = 0;

// only show pics from buddies?
// 0 = disable, 1 = enable --- if enabled, will only show pics posted by members in your buddy list
$gal_buddies = 0;

// use Normal Size Text, or Small Size Text? (0 = Normal Size, 1 = Small Size)
$gal_smalltext = 1;

// put pictures in how many columns?  (1 for left/right block, more for centerblock / article if you wish)
$gal_columns = 1;

// information display flags (0 = No, 1 = Yes)
// display picture title?
$gal_dispTitle = 0;
// display membername who posted pic?
$gal_dispMember = 0;
// display posted date?
$gal_dispDate = 0;
// display category the picture is in?
$gal_dispCategory = 0;
// display number of views?
$gal_dispViews = 0;
// display dimensions?
$gal_dispDimensions = 0;
// display filesize?
$gal_dispSize = 0;
// display picture description?
$gal_dispDescription = 0;


//   *****   SECURITY CONFIGURATION   *****
// do not allow the following category numbers to be displayed
// example: $gal_disallowCats = "4,2,7" - don't show categories 2, 4, or 7
$gal_disallowCats = "";
// select only from the following cats - leave empty for all - NOTE:($gal_disallowCats overrides)
// example: $gal_allowCats = "1,3,4" - show only categories 1, 3, and 4
$gal_allowCats = "";
// Require the user has allowedTo('smfgallery_view') permission to view random pics thumbnails in block?
$gal_viewPermission = 0;

/*
****************************************
****************************************
***  !! END Admin Config Section !!  ***
****************************************
****************************************
*/

//###############################################
//###############################################
//   You shouldn't change anything below here
//###############################################
//###############################################

if (empty($modSettings['gallery_url'])){
   $modSettings['gallery_url'] = $boardurl . '/gallery/';
}

$gal_textclass = empty($gal_smalltext) ? "normaltext" : "smalltext";

// get this user's buddy list
$gal_buddylist = implode(",", $user_info['buddies']);

// prep for our switch routine
if (empty($gal_showtype))
   $gal_showtype = 0;

// sort text
if (empty($gal_sort)){
   $gal_sort_text = 'DESC';
} else {
   $gal_sort_text = '';
}

// are we viewing a member profile and $gal_profile is enabled?
if (!empty($gal_profile) && strtolower($context['current_action']) == "profile"){
   $gal_member = empty($_GET['u']) ? $id_member : $_GET['u'];
}
// allow member to view random pic based on security settings
if (empty($gal_viewPermission) || allowedTo('smfgallery_view')){
   $gal_query = '
         SELECT
            g.thumbfilename,
            g.id_picture,
                g.id_topic,
            g.id_member,
            g.date,
            g.title,
            g.description,
            g.views,
            g.filesize,
            g.height,
            g.width,
            g.commenttotal,
            g.id_cat,
            t.num_replies
         FROM '.$db_prefix.'gallery_pic g INNER JOIN  '.$db_prefix.'topics t ON t.id_topic=g.id_topic
         WHERE g.approved = 1
         '.(empty($gal_member) ? (empty($gal_buddies) ? "" : (empty($gal_buddylist) ? "AND p.id_member = NULL " : "AND g.id_member in ($gal_buddylist)")) : "AND g.id_member = $gal_member" ).'
         '.(empty($gal_disallowCats) ? "" : "   AND g.id_cat NOT IN ($gal_disallowCats)").'
         '.(empty($gal_allowCats) ? "" : "   AND g.id_cat IN ($gal_allowCats)").'
         GROUP BY g.thumbfilename ';

   switch ($gal_showtype){
      // most/least recent
      case 1:
         $gal_query .= '
               ORDER BY g.date '.$gal_sort_text;
         break;

      // most/least viewed
      case 2:
         $gal_query .= '
               ORDER BY g.views '.$gal_sort_text;
         break;

      // most/least commented
      case 3:
         $gal_query .= '
               ORDER BY g.commenttotal '.$gal_sort_text;
         break;

      default:
         $gal_query .= '
               ORDER BY rand() '.$gal_sort_text;
         break;
   }
   $gal_query .= (empty($_GET['gal_viewall']) && !empty($gal_numpics)) ? ' LIMIT '.$gal_numpics : '';
   $gal_result = mysql_query($gal_query);
   if (!$gal_result){
      // error retrieving information from database
      if (mysql_errno() == 1146){
         echo '<p />Error, no database found!<p />';
      } else {
         echo '<p />MySQL error:'.mysql_error().'<p />';
      }
   } else {
      echo "\n".'<table cellspacing="0" cellpadding="5" border="0" align="center" width="90%">'."\n";
   
      $gal_colcnt = 1;
      echo "   <tr>\n";
      while ($row = mysql_fetch_assoc($gal_result)){
         if ($gal_colcnt > $gal_columns){
            // close out the row and start a new row
            echo "   </tr>\n   <tr>\n".'      <td colspan="'.$gal_columns.'"><hr /></td>'."\n   </tr>\n   <tr>\n";
            // reset count to column 1
            $gal_colcnt = 1;
         }
         echo   '      <td class="'.$gal_textclass.'" align="center">'."\n";
         // display title if enabled, make edit link if viewing user is picture poster
         if (!empty($gal_dispTitle)){
            echo "         ".($id_member == $row['id_member'] ? ('<a href="'.$scripturl.'?action=gallery;sa=edit;id='.$row['id_picture'].'">'.$row['title'].'</a>') : $row['title'])."<br />\n";
         }
         // display the picture thumbnail and link it to gallery full picture
         echo   '         <a href="index.php/topic,'.$row['id_topic'].'.0.html"><img src="'.$modSettings['gallery_url'].$row['thumbfilename'].'" /></a><br />'."\n";
         // display poster's name and posted date if enabled
         if (!empty($gal_dispMember) || !empty($gal_dispDate)){
            echo 'inviata';
            if (!empty($gal_dispMember)){
               // display the membername who posted pic?  need to get name based on id_member
               $gal_tmp = mysql_fetch_assoc(mysql_query("SELECT member_name FROM ".$db_prefix."members WHERE id_member = ".$row['id_member']));
               echo ' da <a href="'.$scripturl.'?action=profile;u='.$row['id_member'].'">'.$gal_tmp['member_name'].'</a>';
            }
            if (!empty($gal_dispDate)){
               // display the date it was posted
               echo ' on '.date("d M Y", $row['date']);
            }
            echo "<br />\n";
            if ($row['num_replies']==0)
               echo '<span style="color:red"> Commenti totali: '.$row['num_replies'].'</span>';
            else
               echo 'Commenti totali: '.$row['num_replies'];

            echo "<br />\n";
         }
         // display category if enabled
         if (!empty($gal_dispCategory)){
            // get category name based on category id
            $gal_tmp = mysql_fetch_assoc(mysql_query("SELECT title FROM ".$db_prefix."gallery_cat WHERE id_cat = ".$row['id_cat']));
            echo '<br />in<br /><a href="'.$scripturl.'?action=gallery;cat='.$row['id_cat'].'">'.$gal_tmp['title']."</a><br /><br />\n";
         }
         // display number of views if enabled
         if (!empty($gal_dispViews)){
            echo "Vista ".$row['views']." volte<br />\n";
         }
         // display dimensions if enabled
         if (!empty($gal_dispDimensions)){
            echo $row['width']."w X ".$row['height']."h<br />\n";
         }
         // display filesize if enabled
         if (!empty($gal_dispSize)){
            echo $row['filesize']." bytes<br />\n";
         }
         // display description if enabled
         if (!empty($gal_dispDescription)){
            echo "<br />".$row['description']."<br />\n";
         }
         echo   "      </td>\n";
         $gal_colcnt++;
      }
      mysql_free_result($gal_result);
      echo "   </tr>\n</table>\n";
      if (!empty($gal_member) && empty($_GET['gal_viewall']))
         echo '<br /><a href="'.$boardurl.'/index.php?action=profile;u='.$gal_member.';gal_viewall=1">Vedi tutte le foto di questo utente</a>';
      if (!empty($gal_buddies) && empty($_GET['gal_viewall'])){
         // build the link
         $gal_querystring = $context['TPortal']['querystring'];
         $gal_querystring .= empty($gal_querystring) ? 'gal_viewall=1' : ';gal_viewall=1';
         echo '<br /><a href="'.$boardurl.'/index.php?'.$gal_querystring.'">Vedi tutte le foto degli amici</a>';
      }
   }
} else {
   echo 'Non hai il permesso di vedere le foto!';
}

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Gallery Block Aeva Vs. SMF Gallery Pro
« Reply #3 on: May 24, 2010, 07:05:01 PM »
Good for you -- you figured it out.
 
You might run into a little trouble with that block, as there is a little TinyPortal-specific code in there -- which won't work for SimplePortal. (look for tportal in your code).
 
 
 
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline VegasJay

  • Semi Newbie
  • *
  • Posts: 10
  • Gender: Male
  • Operating several SMF systems, I have no life
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Gallery Block Aeva Vs. SMF Gallery Pro
« Reply #4 on: May 24, 2010, 10:42:16 PM »
So far it seems to be working pretty good, I guess I have not turned on any options that invoke the TP code.

Actually I suddenly !! GOT !! it about how these blocks work, so I decided to port some code I had written for another application into a block and see if I could make it work.

Wad me up and use me for a dish rag, it worked almost right outta the box.  functionally it looks at a text file on some website and randomly selects an image name, the images on the list are all equally sized and loaded on some website, does not have to be the same one the list is on.

It then displays the randomly selected image in the block. Code is below if anyone wants it, since  I am very egg like I am sure it can be improved.

If there is any interest I can clean it up and put some doc's into it and donate it to the cause.

Code: [Select]
   $text_file = 'http://ExReps.com/fileName.txt';
$content = file ($text_file);
$size_of_file = (count($content))-1;
$line_to_choose = rand (0, ($size_of_file));
$image = $content[$line_to_choose];
$image="http://ExReps.com/News/images/".$image;
   ?>
<img border="0" src="<?php echo $image?>" width="180" height="180" alt="<? echo $image; ?> ">

Will work with any images, art work I am using is by a great artist, and friend, who died in a tragic accident back in the 70's