Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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
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
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
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
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
Re: [plugin] [ORPHAN] fpx_image_import
perfect!
working good!
thanks ;)
Offline
Re: [plugin] [ORPHAN] fpx_image_import
Can anyone confirm if this still works with TXP 4.2? I just tried to import a ton of images and they were added to the database but the images weren’t there.
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
#43 2009-11-04 19:27:57
- uli
- Moderator

- From: Cologne
- Registered: 2006-08-15
- Posts: 4,316
Re: [plugin] [ORPHAN] fpx_image_import
Hi Matt,
just a quick test, so I can’t say everything’s fine, but I have new db entries and new files.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: [plugin] [ORPHAN] fpx_image_import
Thanks Uli.
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
Re: [plugin] [ORPHAN] fpx_image_import
grundgesetz wrote:
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);
}
Can this be change to delete only the files without the folder please?
I’m using the uploadify script to upload the images to a folder name “new_gallery” into the “import” folder
and I want that after I upload the images with the “uploadify” script, I will just import the folder and then select the images and change the category.
so the “new_gallery” folder will always be there
(for quick import and not need to mark all the images one by one)
but the files inside will be deleted after importing.
Offline