TWEagle / galleriffic

Automatically exported from code.google.com/p/galleriffic
0 stars 0 forks source link

Addon/Mod: PHP to automatically generate thumbnail list #56

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It seems your feedback blog submission form doesnt like me ... so posting 
here:

A php replacement for the #thumbs div in the html source to dynamically 
list the images in a gallery and thumbnail folder.

Replace your #thumbs  div with my code.... (and save your page as a .PHP) 
and upload
the comments are in the code. Only tested on PHP 5.4

this minor mod will automatically picupe images in the images/gallery 
folder and display their thumbs from the images/thumbs folder (with the 
same filenames) with correct link to the large image. 

Good for people who want to add LOTS of pictures without manually editing 
the links manually.

---

<div id="thumbs">
<ul class="thumbs noscript">
<?php 
/*
    PHP mod for the image thumbnail list generation  in Galleria by 
Codie Morgan
    once this script is inserted all you have to do is drop the images 
and their thumbnails into their folders and they will liist it 
automatically
    good if you need to add a shit load of images and thumbnails
    you can use Irfanview to batch generate thumbnails for your images 
under File->Batch Conversion/rename

    catch me on facebook.com/codiemorganart for questions
*/

$pathtoimages='images/gallery/';    // the folder were your full size 
images are
$pathtothumbs='images/thumbs/';  // the folder were your thumbnails are

// the files in the thumbnails folder MUST have the exact file name of 
their full size versions in the gallery folder

 // the fast way to collect a list of all jpeg files in a directory
 // $collection becomes a array containing all the files that exist in the 
Gallery folder
$collection = glob($pathtoimages.'*.jpg');

// $item is number, $value is file full file path
foreach ($collection as $item => $value){ // the loop through the 
collection
    $strip[]='/';
    $strip[]='.jpg';
    $strip[]='.';
    $filename = basename($value); // the base name of the file 

     // the current path to thumbail is generated with safe  cleanup
    $this_thumb = $pathtothumbs.str_replace($strip, 
'',$filename).'.jpg';

     // the current path to fullsize image is generated with safe  
cleanup
    $this_image  = $pathtoimages.str_replace($strip, 
'',$filename).'.jpg';

    // the output string
    $out='
    <li>
        <a class="thumb" href="'.$this_image.'" title="Image 
'.$item.'">
            <img src="'.$this_thumb.'" alt="'.$item.'" />
        </a>
    </li>';

    //print it to the page
    print $out;
}
?>
</ul>
</div>

Original issue reported on code.google.com by OtakuWea...@gmail.com on 22 Oct 2009 at 7:51

GoogleCodeExporter commented 9 years ago
Sorry, accidently posted as "defect"

Original comment by OtakuWea...@gmail.com on 22 Oct 2009 at 7:53

GoogleCodeExporter commented 9 years ago
i tried using ur change to show all pictures on a folder, but dont working, did 
u 
fix this..?

Original comment by nathyads...@gmail.com on 2 Jan 2010 at 2:34

GoogleCodeExporter commented 9 years ago
Hi there,

Nice mod for the galleriffic module.
I'm using it in Joomla 1.5 now but I can't save the file as a php file. (no I'm 
not putting it in a wrapper).

Is there another way to use folders with thumbs and gallery images?

Original comment by enigma0d...@gmail.com on 23 Jun 2011 at 1:51

GoogleCodeExporter commented 9 years ago
Ill  write a new script as a class. 

Original comment by OtakuWea...@gmail.com on 24 Jun 2011 at 7:45

GoogleCodeExporter commented 9 years ago
Hi,

Wow, that would be great if you could do that.
My eternal thanks for this.

Cheers,

Steve

Original comment by enigma0d...@gmail.com on 24 Jun 2011 at 9:57

GoogleCodeExporter commented 9 years ago
Hi Otaku,

How is the script progessing? 

Cheers,

Steve

Original comment by enigma0d...@gmail.com on 27 Jun 2011 at 7:02

GoogleCodeExporter commented 9 years ago
Hmmm, and then it whent silent...

Is there anyone who can help me out with this one.

It would be really helpfull if it were possible to use folders to place the 
.jpg files in (one for the big ones and one for thumbs).

Please let me know.

Cheers,

Steve

Original comment by enigma0d...@gmail.com on 25 Jul 2011 at 6:44

GoogleCodeExporter commented 9 years ago
GP Code library 
Create thumbnail image by php 
When we upload large size images on server. Uploaded large images take more 
time to load on webpage, so we need to show small size images on our webpage. 
Image thumbnail is a solution to generate uploaded image’s thumbnail to show 
required size images on our website. 
http://codelibrary.googleplus.co.in/create-thumbnail-image-by-php/

Original comment by gpstor...@gmail.com on 12 Apr 2013 at 4:08