A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4751

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

Gallery - mcpaste

Gallery

Von MC_J, 10 Jahre vorher, geschrieben in PHP, aufgerufen 1'903 mal.
URL https://mcpaste.de/view/2102e430 Einbetten
Paste herunterladen oder Rohtext anzeigen
  1. <?php
  2. /**
  3. * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
  4. * Author: MC_J
  5. * Email: mcj.contact@gmail.com
  6. * Version: 1.0
  7. * /***
  8. ***/
  9. // no direct access
  10. defined( '_JEXEC' ) or die( 'Restricted access' );
  11. $rootfolder = $params->get( 'rootfolder', "" );
  12. $folder = $params->get( 'folder', "" );
  13. if (class_exists('JPlatform')) {$jvera =JPlatform::RELEASE;}
  14.  
  15. $ordner = constant("JPATH_ROOT")."/".$rootfolder."/".$folder."/";
  16. $thumbs = constant("JPATH_ROOT")."/".$rootfolder."/".$folder."/thumbs"."/";
  17. ?>
  18.  
  19. <style>
  20. .g_container{
  21.         position: fixed;
  22.         height:10%;
  23.         min-height:75px;
  24.         bottom:0;
  25.         left:0;
  26.         width:100%;
  27. }
  28.  
  29. #g_nav img{
  30.         max-height:100%;
  31.         opacity:0.7;
  32.         float:left;
  33.         margin-right:5px;
  34. }
  35. #g_nav{
  36.         width:100%;
  37.         height:100%;
  38.         transition: bottom 1s;
  39. }
  40. .g_thumbs{
  41.         height:100%;
  42.         position:relative;
  43.         transition: bottom 1s;
  44. }
  45.  
  46. #gallery{
  47.         padding-bottom:5%;
  48.         height:95%;
  49.         width:100%;
  50.         position:relative;
  51. }
  52. .g_preview{
  53.         max-height:100%;
  54.         max-width:100%;
  55.         position:relative;
  56.         top: 0;
  57. }
  58. .gb_next, .gb_prev{
  59.         width:30px;
  60.         height:30px;
  61.         position:relative;
  62.         bottom:-50%;
  63.         background-color:#fff;
  64. }
  65. .gb_next{
  66.         float:right;
  67. }
  68. .gb_prev{
  69.         float:left;
  70. }
  71. </style>
  72.  
  73.  
  74. <?php
  75. function createThumbs( $pathToImages, $pathToThumbs, $thumbWidth )
  76. {
  77.         if(is_dir($pathToThumbs) == false)
  78.         {
  79.                 mkdir($pathToThumbs, 0777);
  80.         }
  81.   // open the directory
  82.   $dir = opendir( $pathToImages );
  83.   //loop through it, looking for any/all JPG files:
  84.   while (false !== ($fname = readdir( $dir ))) {
  85.         // parse path for the extension
  86.         $info = pathinfo($pathToImages . $fname);
  87.         // continue only if this is a JPEG image
  88.         if ( strtolower($info['extension']) == 'jpg' )
  89.         {
  90.                 if(file_exists($pathToThumbs.$fname))
  91.                 {
  92.                 //      echo "Thumb exists <br />";
  93.                 }else{
  94.                 //  echo "Creating thumbnail for {$fname} <br />";
  95.  
  96.                   // load image and get image size
  97.                   $img = imagecreatefromjpeg( "{$pathToImages}{$fname}" );
  98.                   $width = imagesx( $img );
  99.                   $height = imagesy( $img );
  100.                   // calculate thumbnail size
  101.                   $new_width = $thumbWidth;
  102.                   $new_height = floor( $height * ( $thumbWidth / $width ) );
  103.  
  104.                   // create a new temporary image
  105.                   $tmp_img = imagecreatetruecolor( $new_width, $new_height );
  106.  
  107.                   // copy and resize old image into new image
  108.                   imagecopyresized( $tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height );
  109.                   // save thumbnail into a file
  110.                   imagejpeg( $tmp_img, "{$pathToThumbs}{$fname}" );
  111.                 }
  112.         }
  113.         }
  114.   // close the directory
  115.   closedir( $dir );
  116. }
  117. // call createThumb function and pass to it as parameters the path
  118. // to the directory that contains images, the path to the directory
  119. // in which thumbnails will be placed and the thumbnail's width.
  120. // We are assuming that the path will be a relative path working
  121. // both in the filesystem, and through the web for links
  122.  
  123. createThumbs($ordner,$thumbs,300);
  124. ?>
  125.  
  126. <div id="gallery">
  127.                 <div class="gb_next">
  128.                 </div>
  129.                 <div class="gb_prev">
  130.                 </div>
  131.                         <?php
  132.                         // Ordnername
  133.                         //auch komplette Pfade möglich ($ordner = "download/files";)
  134.  
  135.  
  136.                         // Ordner auslesen und Array in Variable speichern
  137.                         $allebilder = scandir($ordner); // Sortierung A-Z
  138.                         // Sortierung Z-A mit scandir($ordner, 1)      
  139.                         ?>
  140.                 <img src="<?php echo $rootfolder."/".$folder."/".$allebilder[2];?>" alt="" style="display:none;" class="g_preview"/>
  141.  
  142.        
  143.         <div class="loading">
  144.                 <span>Loading...</span>
  145.         </div>
  146.         <div class="g_container">
  147.                 <div id="g_nav" class="g_navigation">
  148.                        
  149.                         <div class="g_thumbs"> 
  150.                 <?php
  151.                 // Schleife um Array "$alledateien" aus scandir Funktion auszugeben
  152.                 // Einzeldateien werden dabei in der Variabel $datei abgelegt
  153.                 foreach ($allebilder as $bild) {
  154.                  
  155.                         // Zusammentragen der Dateiinfo
  156.                         $bildinfo = pathinfo($ordner."/".$bild);
  157.                         //Folgende Variablen stehen nach pathinfo zur Verfügung
  158.                         // $dateiinfo['filename'] =Dateiname ohne Dateiendung  *erst mit PHP 5.2
  159.                         // $dateiinfo['dirname'] = Verzeichnisname
  160.                         // $dateiinfo['extension'] = Dateityp -/endung
  161.                         // $dateiinfo['basename'] = voller Dateiname mit Dateiendung
  162.  
  163.                  
  164.                         // Größe ermitteln für Ausgabe
  165.                         $size = ceil(filesize($ordner."/".$bild)/1024);
  166.                         //1024 = kb | 1048576 = MB | 1073741824 = GB
  167.        
  168.                         // scandir liest alle Dateien im Ordner aus, zusätzlich noch "." , ".." als Ordner
  169.                         // Nur echte Dateien anzeigen lassen und keine "Punkt" Ordner
  170.                         // _notes ist eine Ergänzung für Dreamweaver Nutzer, denn DW legt zur besseren Synchronisation diese Datei in den Orndern ab
  171.                         // Thumbs.db ist eine Ergänzung unsichtbare Dateiergänzung die von ACDSee kommt
  172.                         // um weitere ungewollte Dateien von der Anzeige auszuschließen kann man die if Funktion einfach entsprechend erweitern
  173.                         if ($bildinfo['extension'] == "jpg" || $bildinfo['extension'] == "JPG"  || $bildinfo['extension'] == "JPEG" || $bildinfo['extension'] == "jpeg") {
  174.                         ?>
  175.                                
  176.                                         <img src="<?php echo $rootfolder."/".$folder."/thumbs/".$bildinfo['basename'];?>" alt="/<?php echo $rootfolder."/".$folder."/".$bildinfo['basename'];?>" />
  177.                                
  178.                 <?php
  179.                         };
  180.                 };
  181.                 ?>
  182.                         </div>
  183.                 </div>
  184.         </div>
  185. </div>
  186.  
  187. <script>
  188. var j = jQuery.noConflict();
  189.         //the loading image
  190.         var jloader     = j('.loading');
  191.         //the ul element
  192.         var jlist       = j('#g_nav');
  193.         //the current image being shown
  194.         var jcurrImage  = j('#gallery').children('img:first');
  195.         var jbtn_next       = j('.gb_next');
  196.         var jbtn_prev       = j('.gb_prev');
  197.         var current         = 1;
  198.         var jthumbnav           = j('.g_thumbs');
  199.         var jelem           = j('.g_container');
  200.         var jthumbs_wrapper = jelem.find('.g_navigation');
  201.         var jthumbs         = jthumbs_wrapper.children(':first');
  202.  
  203.         j('<img>').load(function(){
  204.                 jloader.hide();
  205.                 jcurrImage.fadeIn(2000);
  206.         }).attr('src',jcurrImage.attr('src'));
  207.  
  208.        
  209.        
  210.        
  211.         j(window).load(function() {
  212.         buildThumbs();
  213.         });
  214.  
  215.         function buildThumbs(){
  216.                         var jelem           = j('.g_container');
  217.                         var jthumbs_wrapper = jelem.find('.g_navigation');
  218.                         var jthumbs         = jthumbs_wrapper.children(':first');
  219.                         //each thumb has 180px and we add 3 of margin
  220.                        
  221.                         var jruntime                    = jthumbs.find('img').length;
  222.                         var tempWidth           = 0;
  223.                 //      alert(j(".g_thumbs img:nth-child(1)").height());
  224.                         for(i=1;i<=jruntime;i++)
  225.                         {
  226.                                 tempWidth = tempWidth + j(".g_thumbs img:nth-child("+i+")").width() + 5;
  227.                         }
  228.                         var finalW          = jthumbs.find('img').length * 183;
  229.                         var finalW                      = tempWidth ;
  230.                         jthumbs.css('width',finalW + 'px');
  231.                         //make this element scrollable
  232.                         makeScrollable(jthumbs_wrapper,jthumbs);
  233.         }
  234.         j( ".g_thumbs img:nth-child(1)" ).addClass('g_active');
  235.         j( ".g_thumbs img:nth-child(2)" ).addClass('g_next');
  236.  
  237.         jlist.find('.g_thumbs img').bind('click',function(){
  238.                 var jthis = j(this);
  239.                 var jnext = jthis.next(1);
  240.                 var jprev = jthis.prev(1);
  241.                 document.location.href="#gallery"
  242.                 jthis.addClass('g_active')
  243.                 jthis.nextAll().removeClass('g_active');
  244.                 jthis.prevAll().removeClass('g_active');
  245.                 jnext.addClass('g_next');
  246.                 jnext.nextAll().removeClass('g_next');
  247.                 jnext.prevAll().removeClass('g_next');
  248.                 jprev.addClass('g_prev');
  249.                 jprev.nextAll().removeClass('g_prev');
  250.                 jprev.prevAll().removeClass('g_prev');
  251.                 jloader.show();
  252.                 j('<img class="g_preview"/>').load(function(){
  253.                         var jthis = j(this);
  254.                         var jcurrImage = j('#gallery').children('img:first');
  255.                         jthis.insertBefore(jcurrImage);
  256.                         jloader.hide();
  257.                         jcurrImage.fadeOut(0,function(){
  258.                                 j(this).remove();
  259.                         });
  260.                        
  261.                 }).attr('src',jthis.attr('alt'));
  262.         }).bind('mouseenter',function(){
  263.                 j(this).stop().animate({'opacity':'1'});
  264.         }).bind('mouseleave',function(){
  265.                 j(this).stop().animate({'opacity':'0.7'});
  266.         });
  267.  
  268.         jlist.bind('mouseenter',function(){
  269.                 j( jthumbnav ).css('bottom','0');
  270.         });
  271.         jlist.bind('mouseleave',function(){
  272.                 j( jthumbnav ).css('bottom','-75%');
  273.         });
  274.         j( document ).ready(function(){
  275.                 j( jthumbnav ).css('bottom','-75%');
  276.         });
  277.        
  278.         function makeScrollable(jouter, jinner){
  279.                 var extra           = 800;
  280.                 //Get menu width
  281.                 var divWidth = jouter.width();
  282.                 //Remove scrollbars
  283.                 jouter.css({
  284.                         overflow: 'hidden',
  285.                 });
  286.                 //Find last image in container
  287.                 var lastElem = jinner.find('img:last');
  288.                 jouter.scrollLeft(0);
  289.  
  290.                 //When user move mouse over menu
  291.                 jouter.unbind('mousemove').bind('mousemove',function(e){
  292.                         var containerWidth = lastElem[0].offsetLeft + lastElem.outerWidth() + 2*extra;
  293.                         var left = (e.pageX - jouter.offset().left) * (containerWidth-divWidth) / divWidth - extra;
  294.                         jouter.scrollLeft( left );
  295.                 });
  296.         }
  297.        
  298.  
  299.  
  300.         jbtn_next.bind('click',function() {
  301.                 var je_next = jthumbnav.find('.g_next');
  302.                 jloader.show();
  303.                 alert(je_next.attr('alt'));
  304.                 j('<img class="g_preview"/>').load(function(){
  305.                         var jcurrImage = j('#gallery').children('img:first');
  306.                         je_next.insertBefore(jcurrImage);
  307.                         jloader.hide();
  308.                         jcurrImage.fadeOut();
  309.                        
  310.                 }).attr('src',je_next.attr('alt'));
  311.         });
  312.        
  313.        
  314.         jbtn_prev.bind('click',showPrev);
  315.  
  316.  
  317.        
  318.          
  319.         function showPrev(){
  320.                 --current;
  321.                 var je_next = jthumbnav.find('.g_thumbs:nth-child('+current+')');
  322.                 if(je_next.length == 0){
  323.                         current = jthumbnav.find('.g_thumbs').length;
  324.                         je_next = jthumbnav.find('.g_thumbs:nth-child('+current+')');
  325.                 }
  326.                 jloader.show();
  327.                 j('<img class="preview"/>').load(function(){
  328.                         var jnewimg         = j(this);
  329.                         var jcurrImage      = j('#gallery').children('img:first');
  330.                         $newimg.insertBefore(jcurrImage);
  331.                         jloader.hide();
  332.                         jcurrImage.fadeOut(2000,function(){j(this).remove();});
  333.                 }).attr('src',je_next.find('img').attr('alt'));
  334.         }
  335. j( window ).resize( function(){
  336.         buildThumbs();
  337. });
  338. j( window ).load(function(){
  339.         setTimeout(function(){
  340.         buildThumbs();
  341.         },50);
  342. });
  343.  
  344. </script>
  345.  
  346.  
  347.  

Antwort auf "Gallery"

Hier kannst Du auf den Paste von oben antworten

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876