Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Show last 5 Images from a Database

Asked Modified Viewed 2,583 times
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
asked
Senior Member

i want show here the last 5 Images form my figure database.
how do I get the images in a row instead of each other

here 2 pics .. first is what i have and second is what i want

my code
<?php
/***************************************************************************
 *   figure_figure_images_panel.php for FIGURELIB                                  *
 *                                                                         *
 *   Copyright (C) 2016 Catzenjaeger                                       *
 *   www.AlienCollectors.com                                               *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/

// Important Files
require_once "../../../maincore.php";
require_once THEMES."templates/header.php";
global $aidlink;
include INFUSIONS."figurelib/infusion_db.php";
require_once INCLUDES."infusions_include.php";

      // LANGUAGE
            if (file_exists(INFUSIONS."figurelib/locale/".LOCALESET."locale_figurelib.php")) {
               include INFUSIONS."figurelib/locale/".LOCALESET."locale_figurelib.php";
            } else {
               include INFUSIONS."figurelib/locale/English/locale_figurelib.php";
            }
            

// If Infusion isn't installed, redirect to Errorpage
if (!db_exists(DB_FIGURE_ITEMS)) { redirect(BASEDIR."error.php?code=404"); }

// Get Settings
$fil_settings = get_settings("figurelib");
      
// Start Site
opentable("<div class='text-bold'>".$locale['stats_001']."</div>");

    
     // SEETING FIGURES PER SITE
      $limit = 6;
      
      // Set Empty Arrays
      $info = array("figure_rows" => 0, "page_nav" => false);
      $info['item'] = array();

      // Count all Figures
      $max_rows = dbcount("(figure_id)", DB_FIGURE_ITEMS, "figure_freigabe=1
                           AND ".groupaccess("figure_visibility")."
                           AND figure_retailprice != ''");
      
      // Check Rowstart
      $_GET['rowstart'] = isset($_GET['rowstart']) && isnum($_GET['rowstart']) && $_GET['rowstart'] <= $max_rows ? $_GET['rowstart'] : 0;   
   
   if ($max_rows) {
    
               $result = dbquery("
                     SELECT
                        tb.figure_id, tb.figure_submitter, tb.figure_retailprice, tb.figure_usedprice, tb.figure_freigabe, tb.figure_pubdate, tb.figure_scale, tb.figure_title, tb.figure_manufacturer, tb.figure_brand, tb.figure_datestamp, tb.figure_cat,
                        tbc.figure_cat_id, tbc.figure_cat_name,
                        tbu.user_id, tbu.user_name, tbu.user_status, tbu.user_avatar,
                        tbm.figure_manufacturer_name,
                        tbb.figure_brand_name,                     
                        tbs.figure_scale_id, tbs.figure_scale_name,                     
                        fuf.figure_userfigures_figure_id, fuf.figure_userfigures_user_id
                     FROM ".DB_FIGURE_ITEMS." AS tb
                     LEFT JOIN ".DB_USERS." AS tbu ON tb.figure_submitter=tbu.user_id
                     LEFT JOIN ".DB_FIGURE_USERFIGURES." AS fuf ON fuf.figure_userfigures_figure_id=tb.figure_id
                     LEFT JOIN ".DB_FIGURE_CATS." AS tbc ON tb.figure_cat=tbc.figure_cat_id
                     LEFT JOIN ".DB_FIGURE_MANUFACTURERS." AS tbm ON tbm.figure_manufacturer_id = tb.figure_manufacturer
                     LEFT JOIN ".DB_FIGURE_BRANDS." AS tbb ON tbb.figure_brand_id = tb.figure_brand
                     LEFT JOIN ".DB_FIGURE_SCALES." AS tbs ON tbs.figure_scale_id = tb.figure_scale
                     WHERE ".(multilang_table("FI") ? "tb.figure_language='".LANGUAGE."' AND" : "")." tb.figure_freigabe='1'
                  AND figure_retailprice != ''   
                  GROUP BY tb.figure_id
                  ORDER BY tb.figure_datestamp DESC
                  LIMIT ".$_GET['rowstart'].",".$limit."               
                  ");
            
             // Pagenav      
           $info['page_nav'] = $max_rows > $limit ? makepagenav($_GET['rowstart'], $limit, $max_rows, 3, FUSION_SELF."?") : 0;
          

    
   // WENN DATEN UNGLEICH = 0 DANN DARSTELLUNG DER DATEN
                     
       if (dbrows($result) == 0) {
         
         
      } else {
         
         openside("");             
                   
      
   while($data = dbarray($result)){
                           
            //echo "<div class='container-fluid'>\n";
            //echo "<div class='table-responsive'>\n";
            //echo "<div class='row'>\n";   
            
            // Get correct Image
            if (dbcount("(figure_images_image_id)", DB_FIGURE_IMAGES, "figure_images_figure_id='".$data['figure_id']."'")) {
               $imageData = dbarray(dbquery("
                  SELECT
                     figure_images_image, figure_images_thumb
                  FROM ".DB_FIGURE_IMAGES."
                  WHERE figure_images_figure_id='".$data['figure_id']."'
                  ORDER BY figure_images_toppic DESC
                  LIMIT 0,1
               "));
               if ($imageData['figure_images_thumb'] && @file_exists(THUMBS_FIGURES.$imageData['figure_images_thumb'])) {
                  $imageURL = THUMBS_FIGURES.$imageData['figure_images_thumb'];
               } elseif ($imageData['figure_images_image'] && @file_exists(IMAGES_FIGURES.$imageData['figure_images_image'])) {
                  $imageURL = IMAGES_FIGURES.$imageData['figure_images_image'];
               } else {
                  $imageURL = INFUSIONS."figurelib/images/default.png";
               }
            } else {
               $imageURL = INFUSIONS."figurelib/images/default.png";
            }
                                    
                  // COLUMN 1 (image clickable)
                  echo "<div class='col-lg-12 col-md-12 col-sm-12 col-xs-12'>\n";   
                     echo "<div class='side-small'><a href='".INFUSIONS."figurelib/figures.php?figure_id=".$data['figure_id']."'>\n<img src='".$imageURL."' alt='".$locale['CLFP_002']." : ".$data['figure_title']."' title='".$locale['CLFP_002']." : ".$data['figure_title']."' style='border:0px;max-height:40px;max-width:40px'/></a>";
                  echo "</div></div>\n";   
                  
         
            
            //echo "</div>\n";
            //echo "</div>\n";
            //echo "</div>\n";   
            
   }
   // PAGE NAV
   //echo "<br><br>\n";   
      echo $info['page_nav'] ? "<div class='text-right'>".$info['page_nav']."</div>" : '';
 closeside();
 
 } 
   }   
    
    

 

// Close Site
closetable();

// Important File
require_once THEMES."templates/footer.php";


Catzenjaeger attached the following file:
ashampoo_snap_20161003_12h55m38s_002_.jpg [No information available / 100 Downloads]
ashampoo_snap_20161003_12h54m58s_001_.jpg [No information available / 93 Downloads]
0 replies

7 posts

C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,842 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

Can't use 5 image with Bootstrap

3 per row is col-**-4
4 per row is col-**-3
6 per row is col-**-2

for 5...

<div class='display-block'>
<div class='display-inline-block m-r-10'>
...
</div>
<div class='display-inline-block m-r-10'>
...
</div>
<div class='display-inline-block m-r-10'>
...
</div>
<div class='display-inline-block m-r-10'>
...
</div>
<div class='display-inline-block m-r-10'>
...
</div>
</div>
0 replies
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
answered
Senior Member

thanx so much .. i will try it smile
0 replies
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
answered
Senior Member

hmn no my problem is, that can i show the last 5 or 6 or whatever but all images
Are displayed below each other ... but I need them next to each other. But I do not know how.

The code above works yes .. only all the pictures are interrelated
0 replies
C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,842 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

Quote

Can't use 5 image with Bootstrap

3 per row is col-**-4
4 per row is col-**-3
6 per row is col-**-2

for 5...

<div class='display-block'>
<div class='display-inline-block m-r-10'>
...
</div>
<div class='display-inline-block m-r-10'>
...
</div>
<div class='display-inline-block m-r-10'>
...
</div>
<div class='display-inline-block m-r-10'>
...
</div>
<div class='display-inline-block m-r-10'>
...
</div>
</div>

- by Chan



if (dbrows($result)) {
echo "<div class='clearifx'>\n";
while ($data = dbarray($result)) {
echo "<div class='display-inline-block m-r-10'>\n";
PUT YOUR IMAGE HERE.
echo "</div>\n";
}
echo "</div>\n";
}
0 replies
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
answered
Senior Member

Thanx Chan but it dosent work for me .. same as before

<?php
/***************************************************************************
 *   figure_figure_images_panel.php for FIGURELIB                                  *
 *                                                                         *
 *   Copyright (C) 2016 Catzenjaeger                                       *
 *   www.AlienCollectors.com                                               *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/

// Important Files
require_once "../../../maincore.php";
require_once THEMES."templates/header.php";
global $aidlink;
include INFUSIONS."figurelib/infusion_db.php";
require_once INCLUDES."infusions_include.php";

      // LANGUAGE
            if (file_exists(INFUSIONS."figurelib/locale/".LOCALESET."locale_figurelib.php")) {
               include INFUSIONS."figurelib/locale/".LOCALESET."locale_figurelib.php";
            } else {
               include INFUSIONS."figurelib/locale/English/locale_figurelib.php";
            }
            

// If Infusion isn't installed, redirect to Errorpage
if (!db_exists(DB_FIGURE_ITEMS)) { redirect(BASEDIR."error.php?code=404"); }

// Get Settings
$fil_settings = get_settings("figurelib");
      
// Start Site
opentable("<div class='text-bold'>".$locale['stats_001']."</div>");

    
     // SEETING FIGURES PER SITE
      $limit = 6;
      
      // Set Empty Arrays
      $info = array("figure_rows" => 0, "page_nav" => false);
      $info['item'] = array();

      // Count all Figures
      $max_rows = dbcount("(figure_id)", DB_FIGURE_ITEMS, "figure_freigabe=1
                           AND ".groupaccess("figure_visibility")."
                           AND figure_retailprice != ''");
      
      // Check Rowstart
      $_GET['rowstart'] = isset($_GET['rowstart']) && isnum($_GET['rowstart']) && $_GET['rowstart'] <= $max_rows ? $_GET['rowstart'] : 0;   
   
   if ($max_rows) {
    
               $result = dbquery("
                     SELECT
                        tb.figure_id, tb.figure_submitter, tb.figure_retailprice, tb.figure_usedprice, tb.figure_freigabe, tb.figure_pubdate, tb.figure_scale, tb.figure_title, tb.figure_manufacturer, tb.figure_brand, tb.figure_datestamp, tb.figure_cat,
                        tbc.figure_cat_id, tbc.figure_cat_name,
                        tbu.user_id, tbu.user_name, tbu.user_status, tbu.user_avatar,
                        tbm.figure_manufacturer_name,
                        tbb.figure_brand_name,                     
                        tbs.figure_scale_id, tbs.figure_scale_name,                     
                        fuf.figure_userfigures_figure_id, fuf.figure_userfigures_user_id
                     FROM ".DB_FIGURE_ITEMS." AS tb
                     LEFT JOIN ".DB_USERS." AS tbu ON tb.figure_submitter=tbu.user_id
                     LEFT JOIN ".DB_FIGURE_USERFIGURES." AS fuf ON fuf.figure_userfigures_figure_id=tb.figure_id
                     LEFT JOIN ".DB_FIGURE_CATS." AS tbc ON tb.figure_cat=tbc.figure_cat_id
                     LEFT JOIN ".DB_FIGURE_MANUFACTURERS." AS tbm ON tbm.figure_manufacturer_id = tb.figure_manufacturer
                     LEFT JOIN ".DB_FIGURE_BRANDS." AS tbb ON tbb.figure_brand_id = tb.figure_brand
                     LEFT JOIN ".DB_FIGURE_SCALES." AS tbs ON tbs.figure_scale_id = tb.figure_scale
                     WHERE ".(multilang_table("FI") ? "tb.figure_language='".LANGUAGE."' AND" : "")." tb.figure_freigabe='1'
                  AND figure_retailprice != ''   
                  GROUP BY tb.figure_id
                  ORDER BY tb.figure_datestamp DESC
                  LIMIT ".$_GET['rowstart'].",".$limit."               
                  ");
            
             // Pagenav      
           $info['page_nav'] = $max_rows > $limit ? makepagenav($_GET['rowstart'], $limit, $max_rows, 3, FUSION_SELF."?") : 0;
          

    
   // WENN DATEN UNGLEICH = 0 DANN DARSTELLUNG DER DATEN
                     
       if (dbrows($result) == 0) {
         
         
      } else {
         
         openside("");             
                   
      
            if (dbrows($result)) {
               echo "<div class='clearifx'>\n";
               while ($data = dbarray($result)) {
                  
                           
            //echo "<div class='container-fluid'>\n";
            //echo "<div class='table-responsive'>\n";
            //echo "<div class='row'>\n";   
            
            // Get correct Image
            if (dbcount("(figure_images_image_id)", DB_FIGURE_IMAGES, "figure_images_figure_id='".$data['figure_id']."'")) {
               $imageData = dbarray(dbquery("
                  SELECT
                     figure_images_image, figure_images_thumb
                  FROM ".DB_FIGURE_IMAGES."
                  WHERE figure_images_figure_id='".$data['figure_id']."'
                  ORDER BY figure_images_toppic DESC
                  LIMIT 0,1
               "));
               if ($imageData['figure_images_thumb'] && @file_exists(THUMBS_FIGURES.$imageData['figure_images_thumb'])) {
                  $imageURL = THUMBS_FIGURES.$imageData['figure_images_thumb'];
               } elseif ($imageData['figure_images_image'] && @file_exists(IMAGES_FIGURES.$imageData['figure_images_image'])) {
                  $imageURL = IMAGES_FIGURES.$imageData['figure_images_image'];
               } else {
                  $imageURL = INFUSIONS."figurelib/images/default.png";
               }
            } else {
               $imageURL = INFUSIONS."figurelib/images/default.png";
            }
                                    
                  // COLUMN 1 (image clickable)
                  
                  
                  //echo "<div class='col-lg-12 col-md-12 col-sm-12 col-xs-12'>\n";   
                     echo "<div class='side-small'><a href='".INFUSIONS."figurelib/figures.php?figure_id=".$data['figure_id']."'>\n<img src='".$imageURL."' alt='".$locale['CLFP_002']." : ".$data['figure_title']."' title='".$locale['CLFP_002']." : ".$data['figure_title']."' style='border:0px;max-height:40px;max-width:40px'/></a>";
                  //echo "</div></div>\n";   
                  
                  
                  

                  

                  echo "</div>\n";
                  }
                  echo "</div>\n";
                  }

   // PAGE NAV
   //echo "<br><br>\n";   
      echo $info['page_nav'] ? "<div class='text-right'>".$info['page_nav']."</div>" : '';
 closeside();
 
 } 
   }   
    
Catzenjaeger attached the following file:
ashampoo_snap_20161016_13h08m06s_008_.jpg [No information available / 90 Downloads]
0 replies
C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,842 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

You did not implement my codes as I've responded?

Like this.
if (dbrows($result)) {
echo "<div class='clearfix'>\n";
while ($data = dbarray($result)) {

            if (dbcount("(figure_images_image_id)", DB_FIGURE_IMAGES, "figure_images_figure_id='".$data['figure_id']."'")) {
               $imageData = dbarray(dbquery("
                  SELECT
                     figure_images_image, figure_images_thumb
                  FROM ".DB_FIGURE_IMAGES."
                  WHERE figure_images_figure_id='".$data['figure_id']."'
                  ORDER BY figure_images_toppic DESC
                  LIMIT 0,1
               "));
               if ($imageData['figure_images_thumb'] && @file_exists(THUMBS_FIGURES.$imageData['figure_images_thumb'])) {
                  $imageURL = THUMBS_FIGURES.$imageData['figure_images_thumb'];
               } elseif ($imageData['figure_images_image'] && @file_exists(IMAGES_FIGURES.$imageData['figure_images_image'])) {
                  $imageURL = IMAGES_FIGURES.$imageData['figure_images_image'];
               } else {
                  $imageURL = INFUSIONS."figurelib/images/default.png";
               }
            } else {
               $imageURL = INFUSIONS."figurelib/images/default.png";
            }

echo "<div class='display-inline-block m-r-10'>\n";
echo "<a href='".INFUSIONS."figurelib/figures.php?figure_id=".$data['figure_id']."'>\n<img src='".$imageURL."' alt='".$locale['CLFP_002']." : ".$data['figure_title']."' title='".$locale['CLFP_002']." : ".$data['figure_title']."' style='border:0px;max-height:40px;max-width:40px'/>";
echo "</div>\n";
}
echo "</div>\n";
}


See it working: http://codepen.io/fredchan/pen/wzYBdN

The CSS Classes are in .default.css already loaded with each and every distributed copy of PHPFusion without need of additional styles.css.
https://github.com/PHPFusion/PHPFusion/blob/9.02/themes/templates/default.css - PHPFusion 9 has got it's own CSS library as well. We've been building for 3 years now.
Edited by Chan on 18-10-2016 00:52,
0 replies
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
answered
Senior Member

thanx thats was the solution ... result here: http://aliencollectors.com/site/infusions/figurelib/panels/figurelib_latest_images_panel.php
thanx for help me again and again :)
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 7 posts
  • Votes 0 votes
  • Topic users 2 members

2 participants

C
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
C
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,842 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet