SELFPHP: Version 5.8.2 Befehlsreferenz - Tutorial – Kochbuch – Forum für PHP Einsteiger und professionelle Entwickler

SELFPHP


Professional CronJob-Service

Suche



CronJob-Service    
bei SELFPHP mit ...



 + minütlichen Aufrufen
 + eigenem Crontab Eintrag
 + unbegrenzten CronJobs
 + Statistiken
 + Beispielaufrufen
 + Control-Bereich

Führen Sie mit den CronJobs von SELFPHP zeitgesteuert Programme auf Ihrem Server aus. Weitere Infos



:: Buchempfehlung ::

PHP 5.3 & MySQL 5.1

PHP 5.3 & MySQL 5.1 zur Buchempfehlung
 

:: Anbieterverzeichnis ::

Globale Branchen

Informieren Sie sich über ausgewählte Unternehmen im Anbieterverzeichnis von SELFPHP  

 

:: Newsletter ::

Abonnieren Sie hier den kostenlosen SELFPHP Newsletter!

Vorname: 
Name:
E-Mail:
 
 

Zurück   PHP Forum > SELFPHP > PHP Grundlagen

PHP Grundlagen Hier kann über grundlegende Probleme oder Anfängerschwierigkeiten diskutiert werden

Antwort
 
Themen-Optionen Ansicht
  #1  
Alt 13.07.2012, 17:54:32
Flurit Flurit ist offline
Anfänger
 
Registriert seit: Jul 2012
Alter: 60
Beiträge: 7
Zusatzeinfügung für Gifbilder in einer jpg Galerie

Hallo
Erstmal ich bin neuling bei php Sachen.
Ich habe ein nettes Bildergaleriescript das sehr einfach zu händeln ist.
Jedoch sind nur jpg erlaubt und keine gif Bilder.
Nachfragen beim Hersteller ist nicht möglich, da die Seite nicht erreichbar ist.
Das Script stammt aus dem jahre 2003-05
Könnte sich jemand bereit erklären mir hier weiter zuhelfen?
Was und wo müsste ich einfügen.
Anbei die dateien die dafür zuständig sind.
1.function php
PHP-Code:
 *
 */
function 
showImg($aPath$aFn$aIdx$aThisPage$aSubDir="")
{
  global 
$g_twidth$g_dispFn$g_thumb_worh$g_showInPopup$g_popupWidth$g_popupHeight$g_shrinkPopup;

  
$fullpath $aPath.$aFn;

  
// find the width and height of the thumbnail
  
$imgsize GetImageSize($fullpath);
  if(
$g_thumb_worh == 'w') {
    
$twidth $g_twidth;
    
$theight $imgsize[1] / ($imgsize[0]/$twidth);
  } else {
    
$theight $g_twidth;
    
$twidth $imgsize[0] / ($imgsize[1]/$theight);
  }

  
// generate the html
  
echo "<td>";
  if(
$aSubDir != "") {
    echo 
"<center><a href=\"$PHP_SELF?path=$aPath\"><img border=\"0\" width=\"$twidth\" height=\"$theight\" src=\"genthumbs.php?image=$fullpath&w=$twidth\"></img></a></center>";
  } else {
    
// need scrollbar?
    
$sb "yes";
    if(
$g_showInPopup == 'check') {
      
$w $g_popupWidth;
      
$h $g_popupHeight;
      if(
$g_shrinkPopup == 'check') {
        
$picsize GetImageSize($aPath.$aFn);
        if(
$picsize[0]+10 $w && $picsize[1]+10 $h) {
          
$w $picsize[0]+10;
          
$h $picsize[1]+10;
          
$sb "no";
        }

      }
      echo 
"<center><a href=# onclick=\"javascript:window.open('$aPath$aFn', '_blank', 'width=$w, height=$h, scrollbars=$sb');return false\"><img border=\"0\" width=\"$twidth\" height=\"$theight\" src=\"genthumbs.php?image=$fullpath&w=$twidth\"></img></a></center>";

    } else
      echo 
"<center><a href=\"$PHP_SELF?path=$aPath&page=$aThisPage&img=$aFn&idx=$aIdx\"><img border=\"0\" width=\"$twidth\" height=\"$theight\" src=\"genthumbs.php?image=$fullpath&w=$twidth\"></img></a></center>";
  }

  
// display filename?
  
if($g_dispFn) {
    echo 
"<br><center>";
    if(
$aSubDir == "") {
      
$l strlen($aFn) - 4;
      echo 
substr($aFn0$l);
    } else {
      echo 
$aSubDir."[dir]";
    }
    echo 
"</center>";
  }
  echo 
"</td>";

}

/*
 * show the image in real size
 */
function showBigImg($aPath$aIdx)
{
  global 
$files$isDir;

  echo 
"<center>";
  echo 
"<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\">";

  if(
$isDir[$files[$aIdx]]) {
    
showDir($aPath$files[$aIdx]);
  } else {
    
// generate the html
    
echo "<td>";
    echo 
"<center><img border=\"0\" src=\"".$aPath.$files[$aIdx]."\"></img></center>";
    echo 
"</td>";

    echo 
"</table>";
    echo 
"</center>";
  }
}

/*
 * get the filename of the first image from a folder
 */
function getFirstImgFn($aPath$aExt)
{
  
$dir_handle = @opendir($aPath) or die("Unable to open $aPath");

  while(
$file readdir($dir_handle)) {
    
$fullpath $aPath.$file;

    if(
is_dir($fullpath) == false) {
      
$ext substr($file, -4);
      if(
strtolower($ext) == $aExt) {
        return 
$file;
      }
    }
  }
  
/*
   * return empty if no img exists.
   */
  
return "";
}

/*
 * get the filename of a random image from a folder
 */
function getRandomImgFn($aPath$aExt)
{
  
$dir_handle = @opendir($aPath) or die("Unable to open $aPath");

  
$imgfiles = array();
  while(
$file readdir($dir_handle)) {
    
$fullpath $aPath.$file;

    if(
is_dir($fullpath) == false) {
      
$ext substr($file, -4);
      if(
strtolower($ext) == $aExt) {
        
$imgfiles[] = $file;
      }
    }
  }

  
$num count($imgfiles);
  if(
$num <= 0) {
    
/*
     * return empty if no img exists.
     */
    
return "";
  }

  
/*
   * randomly pick one
   */
  
$idx rand(0$num-1);
  return 
$imgfiles[$idx];

}

/*
 * show the thumb / image of a folder
 */
function showDir($aPath$aFn)
{
  global 
$g_showFirstThumb$g_folderImg;
  
$fullpath $aPath.$aFn."/";

  
// 3 --> first jpg image, 4 --> random jpg image
  
if($g_folderImg == '3' || $g_folderImg == '4') {
     
$fn "";
     if(
$g_folderImg == '3')
       
$fn getFirstImgFn($fullpath'.jpg');
     else
       
$fn getRandomImgFn($fullpath'.jpg');

     if(
$fn != "") {
       
showImg($fullpath$fn"0""0"$aFn);
       return;
     }
  }

  echo 
"<td>";
  
$done false;
  
// 2 --> first gif image
  
if($g_folderImg == '2') {
    
$fn getFirstImgFn($fullpath'.gif');
    if(
$fn != "") {
      
$imgsize GetImageSize($fullpath.$fn);
      echo 
"<center><a href=\"$PHP_SELF?path=$fullpath\"><img border=\"0\" width=\"$imgsize[0]\" height=\"$imgsize[1]\" src=\"$fullpath$fn\"></img></a></center>";
      
$done true;
    }
  }

  
// default is folder.gif
  
if($done == false) {
    
$imgsize GetImageSize("folder.gif");
    echo 
"<center><a href=\"$PHP_SELF?path=$fullpath\"><img border=\"0\" width=\"$imgsize[0]\" height=\"$imgsize[1]\" src=\"folder.gif\"></img></a></center>";
  }

  echo 
"<br><center>$aFn</center>";
  echo 
"</td>";

}

/*
 * show 1 row of thumbs
 */
function showImgRow($aPath$aFiles$aIsDir$aThisPage$aStart$aEnd)
{
  echo 
"<tr>";
  for(
$i=$aStart$i<$aEnd$i++) {
    if(
$aIsDir["_".$aFiles[$i]]) {
      
showDir($aPath$aFiles[$i]);
    } else {
      
showImg($aPath$aFiles[$i], $i$aThisPage);
    }
  }
  echo 
"</tr>";
}

/*
 * show the whole table of thumbs
 */
function showImgTable($aPath$aFiles$aIsDir$aThisPage,
    
$aNumCols$aNumRows)
{
  global 
$g_spacing;

  
$numPerPage $aNumRows $aNumCols;
  
$totalFiles count($aFiles);
  
$start $aThisPage $numPerPage;
  
$end $start $numPerPage;
  
$end min($end$totalFiles);

  echo 
"<center>";
  echo 
"<table border=\"0\" cellspacing=\"$g_spacing\" cellpadding=\"0\">";

  while(
$start $end) {
    
$e min($start $aNumCols$end);
    
showImgRow($aPath$aFiles$aIsDir$aThisPage$start$e);
    
$start += $aNumCols;
  }

  echo 
"</table>";
  echo 
"</center>";
}

/*
 * show the links to different pages
 */
function showPageLinks($aPath$aNumFiles$aThisPage$aIdx$aNumCols$aNumRows)
{
  global 
$files;
  
$numPerPage $aNumCols $aNumRows;
  
$numPages ceil($aNumFiles $numPerPage);

  
/*
   * reverse finding '/' start from the second last char
   * since the last char must be '/'
   */
  
$pdir "";
  
$plen strlen($aPath);
  for(
$j=$plen-2$j>0$j--) {
    if(
$aPath[$j] == '/') {
      
$pdir substr($aPath0$j+1);
      break;
    }
  }

  echo 
"<br><center>";
  echo 
"<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\">";
  echo 
"<tr>";
  if(
$aIdx != "") {
    
// Showing back link
    
echo "<td><a href=\"$PHP_SELF?path=$aPath&page=$aThisPage\">Zur&uuml;ck zur Miniaturansicht</a></td>";
    
// show prev, next link
    
if($aIdx 0) {
      
$idx $aIdx 1;
      echo 
"<td><a href=\"$PHP_SELF?path=$aPath&page=$aThisPage&idx=$idx\">&lt;</a></td>";
    }
    if(
$aIdx count($files)) {
      
$idx $aIdx 1;
      echo 
"<td><a href=\"$PHP_SELF?path=$aPath&page=$aThisPage&idx=$idx\">&gt;</a></td>";
    }
  } else {
    
// show the up link
    
if($pdir != "") {
      echo 
"<td><a href=\"$PHP_SELF?path=$pdir\">Zur Startansicht</a></td>";
    }
    
// show the page links
    
if($numPages == 0) {
      echo 
"<td>No image in this folder</td>";
    } else {
      
// show only 10 pages
      
$minp 0;
      
$maxp 10;
      if(
$numPages 10) {
        
$minp floor($aThisPage/10) * 10;
        
$maxp ceil(($aThisPage+1)/10) * 10;
      }
      
$maxp min($maxp$numPages);

      echo 
"<td> Seite </td>";

      
// show the prev link
      
if($minp >= 10) {
        
$prevp $minp 1;
        echo 
"<td><a href=\"$PHP_SELF?path=$aPath&page=$prevp\">&lt;</a></td>";
      }

      
// show page no(s)
      
for($i=$minp$i<$maxp$i++) {
        
$p $i 1;
        if(
$aThisPage == $i) {
          echo 
"<td><b>$p</b></td>";
        } else {
          echo 
"<td><a href=\"$PHP_SELF?path=$aPath&page=$i\">$p</a></td>";
        }
      }

      
// show the next link
      
if($maxp $numPages) {
        
$nextp $maxp;
        echo 
"<td><a href=\"$PHP_SELF?path=$aPath&page=$nextp\">&gt;</a></td>";
      }
    }
  }
  echo 
"</tr>";
  echo 
"</table>";
  echo 
"</center>";
}

function 
showFooter()
{
  echo 
"<center><font size=\"-2\"><a target=\"_blank\" href=\"http://www.flash-here.com/downloads/fhimage.html\">FhImage</a>, powered by <a target=\"_blank\" href=\"http://www.flash-here.com\">Flash-here.com</a></font></center>";

}

// case insensitive comparison
function cicmp($a$b)
{
  return 
strcasecmp($a$b);
}


/*
 * read file / dir names from a directory
 */
function readFiles($aPath, &$aFiles, &$aIsDir)
{

  global 
$g_sortByFn$g_insensitive_sort;
  
$confdir "imgconfig";

  
$dir_handle = @opendir($aPath) or die("Unable to open $aPath");

  while(
$file readdir($dir_handle)) {
    
$fullpath $aPath.$file;

    if(
is_dir($fullpath)) {
      if(
$file != '.' && $file != '..' && $file != $confdir) {
        
$aFiles[] = $file;
        
$tmparray = array("_".$file => true);
        
$aIsDir array_merge($aIsDir$tmparray);
      }
    } else {
      
$ext substr($file, -4);
      if(
$file[0] != '.' && (strtolower($ext) == '.jpg')) {
        
$aFiles[] = $file;
        
$tmparray = array("_".$file => false);
        
$aIsDir array_merge($aIsDir$tmparray);
      }
    }
    if(
$g_sortByFn == 'check') {
      if(
$g_insensitive_sort == 'check') {
          
usort($aFiles"cicmp");
      } else {
        
sort($aFiles);
      }
    }
  }

  
closedir($dir_handle);
}

function 
adjustPath($aPath)
{
  
$ret $aPath;
  if(!
$ret)
    
$ret "./";
  if(
substr($ret, -1) != "/")
  
$ret $ret.'/';

  
// reset to home, if illegal access
  
if(substr($ret01) != '.' || strstr($ret"..")) {
    
$ret'./';
  }

  return 
$ret;
}

?> 
Mit Zitat antworten
  #2  
Alt 13.07.2012, 17:55:11
Flurit Flurit ist offline
Anfänger
 
Registriert seit: Jul 2012
Alter: 60
Beiträge: 7
AW: Zusatzeinfügung für Gifbilder in einer jpg Galerie

2 Datei !

2.genthums
PHP-Code:
*******************************************************/


function 
resizejpg($imagefile,$w)
{
    
// check path to prevent illegal access to other files
    
if(substr($imagefile01) != '.' || strstr($imagefile"..")) {
        echo 
"Illegal access!";exit;
    }

    
// seems gif not supported by GD now
    
$ext substr($imagefile, -3);
    if(
strtolower($ext) == "gif") {
      if (!
$src_img imagecreatefromgif($imagefile)) {
        echo 
"Error opening Image file!";exit;
      }
    } else if(
strtolower($ext) == "jpg") {
      if (!
$src_img imagecreatefromjpeg($imagefile)) {
        echo 
"Error opening Image file!";exit;
      }
    } else {
      echo 
"Error file type not supported!";exit;
    }

    
$hw getimagesize($imagefile);
    
$new_w $w;
    
$new_h $hw["1"]/($hw["0"]/$w);
    
// truecolor supported only in GD 2.0 or later
    
$dst_img = @imagecreatetruecolor($new_w$new_h);
    if(!
$dst_img) {
      
$dst_img imageCreate($new_w$new_h);
    }

    
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));
    
imagejpeg($dst_img);
    
ImageDestroy($src_img);
    
ImageDestroy($dst_img);
}

header("Content-type: image/jpeg");

// in case register global is off
foreach($HTTP_GET_VARS as $key => $val) {
   $
$key $val;
   global $
$key;
}

if (
$w == ""){$w "100";}
resizejpg("./".$image,$w);


?> 


Danke im Vorraus
Mit Zitat antworten
  #3  
Alt 13.07.2012, 19:42:01
Benutzerbild von vt1816
vt1816 vt1816 ist offline
Administrator
 
Registriert seit: Jul 2004
Beiträge: 3.707
AW: Zusatzeinfügung für Gifbilder in einer jpg Galerie

Hallo und wilkommen hier im Forum.


Gerne helfen wir Dir hier. Jedoch hat sich bei PHP seit 2003-2005 soviel getan, dass es unwirtschaftlich wäre an dem Script noch Änderungen/Anpassungen vorzunehmen.

Hast Du Dich im www schon mal nach einem gleichwertigen neueren Script umgesehen?
__________________
Gruss vt1816
Erwarte nicht, dass sich jemand mehr Mühe mit der Antwort gibt als Du Dir mit der Frage.
. . . . . Feedback wäre wünschenswert

Ich werde keinen privaten 1:1 Support leisten, außer ich biete ihn ausdrücklich an.
Ansosnten gilt: Hilfe ausserhalb dieses Thread (PN, WhatsApp, Skype, Mail, ICQ, etc...) nur per Barzahlung oder Vorauskasse!

Wenn man sich selbst als "Noob" bezeichnet, sollte man die Finger davon lassen.
Wenn man gewillt ist daran etwas zu ändern, lernt man Grundlagen!
Mit Zitat antworten
  #4  
Alt 14.07.2012, 09:08:29
Flurit Flurit ist offline
Anfänger
 
Registriert seit: Jul 2012
Alter: 60
Beiträge: 7
AW: Zusatzeinfügung für Gifbilder in einer jpg Galerie

Hallo vt
Danke für die rasche Antwort.
Es ist mir schon klar, das sich bei den neuen php Einstellungen vieles geändert hat.

Das gute an diesem Script ist das, das es sich sehr gut händeln lässt ohne grosses "schnickschnack"
Einfache Bilderordneranlegung nicht Datenbank abhängig (was wiederum ein Hackangriff fast unmöglich macht)
Habe zwar schon danach gegoogelt aber nichts dergleichen gefunden, wo genau so easy zu Handhaben ist.
Es wäre jedoch sehr nett wenn jemand dieses script umändern könnte oder mir schreibt
was man machen muss.
Mit Zitat antworten
Antwort


Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
 
Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind aus.
[IMG] Code ist aus.
HTML-Code ist aus.

Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Galerie gesucht mit User-Verwaltung KST Off Topic Area 7 21.03.2008 15:32:09
Meine Galerie funktionier nicht! djwurzi PHP Grundlagen 6 03.11.2006 17:51:08
Bilder auslesen, anzeigen, öffnen (Galerie) - ANFÄNGER ;) StiNgray PHP Grundlagen 36 15.09.2006 12:09:49
PHP Galerie Hilfe Neodan PHP Grundlagen 28 11.07.2006 22:06:55
Probleme mit Galerie Script hoschy PHP Grundlagen 4 09.11.2005 01:03:11


Alle Zeitangaben in WEZ +2. Es ist jetzt 18:35:11 Uhr.


Powered by vBulletin® Version 3.8.3 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.


© 2001-2024 E-Mail SELFPHP OHG, info@selfphp.deImpressumKontakt