Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 05-07-2009, 04:09 AM PHP image gallery
Junior Talker

Posts: 1
Name: Philip
Trades: 0
Hi,
I would really appreciate some help with my php problem. I'm pretty new to php and have been trying to understand more by adapting a php script a friend wrote for me that looks in a folder and displays the jpgs it finds as a set of thumbnails linked to larger images.

See here: http://www.squirl-art.com/illustrati...rationmain.php

I wanted to take this script and combine it with the jquery galleria (http://code.google.com/p/galleria/) to make a prettier gallery.
All my attempts so far have failed, the page works but it doesn't find the images.
I need the php to output an unordered list that Galleria can work from.

The folder structure is

Main folder - php script
- images (main image folder) - images (images folder)
- thumbs (thumbs folder)

I don't actually need the thumbs folder anymore as the Galleria script generates it's own. I only left it in as I thought it would be easier to figure out that way.

I've only included the php and a section of the html where the php function is called.

Can anyone help me?


PHP Code:

<?php

$directory 
'images';
$thumbfolder 'thumbs';
$imagefolder 'images';

function 
get_images($dir$imgs$thmbs) {

$thumbs $dir.'/'.$thmbs;
$images $dir.'/'.$imgs;
    
 if (
$handle opendir($thumbs)) {
    
  
        while (
false !== ($file readdir($handle))) {
        
        
            if (
$file != '.' && $file != '..'){

                
echo 
'<li><img rel="'.$images.'/'.$file.'" class="thumb" style="width: 75; height: 75px; margin-left: 0px; opacity: 0.3;" src="'.$thumbs.'/'.$file.'" alt="'.substr($file0, -4).'" title="'.substr($file0, -4)."></li>";
            }
            
        }
        
    } else {
    
    
    
        echo 
'<p>Directory not available</p>';
        }}
?>

the function is called in the html like this
HTML Code:
<div class="demo">

<ul class="gallery_demo_unstyled gallery_demo galleria">
<h1>David Small</h1>
    <?php 



get_images($directory, $imagefolder, $thumbfolder); 

?>
</ul>
<p class="nav"><a href="#" onclick="$.galleria.prev(); return false;">« previous</a> | <a href="#" onclick="$.galleria.next(); return false;">next »</a></p>
</div>

Last edited by barebones; 05-07-2009 at 04:14 AM..
barebones is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to PHP image gallery
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.08131 seconds with 12 queries