Textpattern Forum

You are not logged in. Register | Login | Help

#31 2008-06-03 15:43:56

mrdale
Moderator
From: Walla Walla
Registered: 2004-11-19
Posts: 2,050
Website

Re: [plugin] [ORPHAN] fpx_image_import

Yep: flashpix> Lotsa people would love to see the delete on import put back in from aba days… how about putting it in as optional?

Also, I noticed that on solaris boxen, my imports are not adding thumbs using pretty vanilla options, wonder why… any ideas

Offline

#32 2008-06-09 07:46:55

qlontz
New Member
Registered: 2008-06-03
Posts: 2

Re: [plugin] [ORPHAN] fpx_image_import

Still no word on the option to delete imported files? If anyone has a workaround for this, I would REALLY appreciate the help.

Offline

#33 2008-08-04 12:07:19

jameslomax
Member
From: UK
Registered: 2005-05-09
Posts: 391
Website

Re: [plugin] [ORPHAN] fpx_image_import

Anyone know how I can modify this plug in: what I need is to change the location of the ‘import’ directory. Presumably, you can change the code in a quick and simple way to point to another directory?

Offline

#34 2008-08-04 13:34:57

aba
Plugin Author
Registered: 2004-04-14
Posts: 119

Re: [plugin] [ORPHAN] fpx_image_import

jameslomax wrote:

Anyone know how I can modify this plug in: what I need is to change the location of the ‘import’ directory. Presumably, you can change the code in a quick and simple way to point to another directory?

5th line:

define("IMIMPORTPATH", $path_to_site.'/'.$img_dir.'/import/');

change to your liking – for example:

define("IMIMPORTPATH", "/mypath/');

Offline

#35 2008-08-04 15:36:43

jameslomax
Member
From: UK
Registered: 2005-05-09
Posts: 391
Website

Re: [plugin] [ORPHAN] fpx_image_import

Ah, nice and simple thanks.
Not working though, with a few variations.

There’s a “ in that code I don’t understand; I can’t see where it comes from and if it should be there.

My ‘import’ directory is at the same level as the ‘images’ folder, but I don’t know the code to point there. Is that code complete, or is there someting more to add to it? I need the exact code, to copy and paste.

Offline

#36 2008-08-04 16:17:49

aba
Plugin Author
Registered: 2004-04-14
Posts: 119

Re: [plugin] [ORPHAN] fpx_image_import

jameslomax wrote:

There’s a “ in that code I don’t understand; I can’t see where it comes from and if it should be there.

I made an error in my example: change the 3rd “ in my example to an ‘ – sorry

My ‘import’ directory is at the same level as the ‘images’ folder, but I don’t know the code to point there. Is that code complete, or is there someting more to add to it? I need the exact code, to copy and paste.

I’m not quite sure where the problem is, because you could easily put an import path in your images directory, but:

define("IMIMPORTPATH", $path_to_site.'/import');

$path_to_site will be replaced by the path to your textpatterninstallation and in there should be the images directory.
Using above example the import directory (you may rename it if you like by changing the statement) would be on the same level as images

Offline

#37 2008-08-04 16:34:17

jameslomax
Member
From: UK
Registered: 2005-05-09
Posts: 391
Website

Re: [plugin] [ORPHAN] fpx_image_import

Aha! I worked it out by intuitive trial and error. Yay me. Yes, that’s the code that works, thanks.

Offline

#38 2008-11-15 11:47:15

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 542
Website

Re: [plugin] [ORPHAN] fpx_image_import

qlontz wrote:

Still no word on the option to delete imported files? If anyone has a workaround for this, I would REALLY appreciate the help.

+1

I will love if it will delete the gallery folder and the files from the import folder after the files have been imported

;)

Offline

#39 2008-11-15 18:02:47

mrdale
Moderator
From: Walla Walla
Registered: 2004-11-19
Posts: 2,050
Website

Re: [plugin] [ORPHAN] fpx_image_import

I think the only way to make this happen is a bounty… I’m all bountied out tho…

Offline

#40 2009-04-18 00:54:00

grundgesetz
Plugin Author
From: Germany
Registered: 2009-04-17
Posts: 24

Re: [plugin] [ORPHAN] fpx_image_import

THE BLUE DRAGON wrote:

I will love if it will delete the gallery folder and the files from the import folder after the files have been imported
;)

Quick-and-Dirty solution:

Step 1

Around Line 234:

change

         } //while
        @closedir($handlesub)

to

         } //while
        @closedir($handlesub)
        rmdirr(IMIMPORTPATH.$file);

Step 2

At the very end of the plugin change

       return !$hasError;
} //function fpx_import

to

       return !$hasError;
} //function fpx_import.
/**
 * Delete a file, or a folder and its contents (recursive algorithm)
 *
 * @author      Aidan Lister <aidan@php.net>
 * @version     1.0.3
 * @link        http://aidanlister.com/repos/v/function.rmdirr.php
 * @param       string   $dirname    Directory to delete
 * @return      bool     Returns TRUE on success, FALSE on failure
 */
function rmdirr($dirname)
{
    // Sanity check
    if (!file_exists($dirname)) {
        return false;
    }
    // Simple delete for a file
    if (is_file($dirname) || is_link($dirname)) {
        return unlink($dirname);
    }
    // Loop through the folder
    $dir = dir($dirname);
    while (false !== $entry = $dir->read()) {
        // Skip pointers
        if ($entry == '.' || $entry == '..') {
            continue;
        }
        // Recurse
        rmdirr($dirname . DIRECTORY_SEPARATOR . $entry);
    }
    // Clean up
    $dir->close();
    return rmdir($dirname);
}

Beware: The folders will be deleted in either case (i.e. if import failed)!

Greetings,
Jonas

Last edited by grundgesetz (2009-04-18 00:55:24)

Offline

Board footer

Powered by FluxBB