TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 10-25-2007, 01:39 PM   #1 (permalink)
The Visitor
 
TeIXe's Avatar
 
Join Date: Oct 2007
Location: UK
Posts: 2
Thanks: 0
TeIXe is on a distinguished road
Default Directory Control Panel (Images Mainly)

Hi,

Is there anyway that I could display the images in a directory (for example uploads) as a thumbnail and then a few links to delete it or rename each image?

Sort of like a Image Back End Control Panel, I suppose.

Any help would be greatly appreciated.

Gareth.
Send a message via MSN to TeIXe
TeIXe is offline  
Reply With Quote
Old 10-25-2007, 01:51 PM   #2 (permalink)
Super Moderator
Advanced Programmer 
 
bluesaga's Avatar
 
Join Date: Sep 2007
Posts: 165
Thanks: 0
bluesaga is on a distinguished road
Default

Well the management of the uploads is easy:

http://uk3.php.net/manual/en/ref.filesystem.php

See the file system functions, and use them to list and rename, delete etc the files. The file functions are a good place to start with, but it would be worth you adding mysql support for management of the files eventually.
bluesaga is offline  
Reply With Quote
Old 10-25-2007, 02:44 PM   #3 (permalink)
The Reckoner
Advanced Programmer Top Contributor 
 
Karl's Avatar
 
Join Date: Sep 2007
Posts: 437
Thanks: 22
Karl is on a distinguished road
Default

Here's a bit of code for the image part. It could be cleaned up a bit better, but it's enough to get your started and it works (currently only with jpeg)

PHP Code:

<?php

$szImagesDir 
'images/';
$szThumbsDir 'images/thumbs/';

foreach (
glob($szImagesDir '*.{jpg,JPG}'GLOB_BRACE) as $szImagePath)
{
    
$aImagePathParts explode('/'$szImagePath);
    
$szFileName end($aImagePathParts);

    if (!
file_exists($szThumbsDir $szFileName))
    {
        
$pImageHandle imagecreatefromjpeg($szImagePath);

        if (!
$pImageHandle)
        {
            continue;
        }

        
$aSize getimagesize($szImagePath);
        
        
$pNewImageHandle imagecreatetruecolor(6464);
        
        
imagecopyresampled($pNewImageHandle$pImageHandle00006464$aSize[0], $aSize[1]);
        
        
imagejpeg($pNewImageHandle$szThumbsDir $szFileName);        
    }
    
    echo 
'<img src="' $szThumbsDir $szFileName '" />';
}

?>
Simply change the two directory paths at the top to point to your images and thumb folders. The thumbs folder is used to store thumbnails of each image - you'll need to create this.

Hope it helps.
__________________
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
Karl is offline  
Reply With Quote
Old 11-02-2007, 03:12 PM   #4 (permalink)
The Visitor
 
TeIXe's Avatar
 
Join Date: Oct 2007
Location: UK
Posts: 2
Thanks: 0
TeIXe is on a distinguished road
Default

Wow thank you; I completely missed your posts! :O
Send a message via MSN to TeIXe
TeIXe is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

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


All times are GMT. The time now is 12:40 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design