Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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,310
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
Re: [plugin] [ORPHAN] fpx_image_import
Might be easier to just recreate the directory after it’s deleted.
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
Re: [plugin] [ORPHAN] fpx_image_import
MattD wrote:
Might be easier to just recreate the directory after it’s deleted.
cool but where do I add this code?: mkdir("/images/import/new_gallery", 0755);
for now (thanks for your link) I just changed the return rmdir($dirname);
to return ;
and it works ;)
Offline
#48 2010-07-28 12:37:26
- gfdesign
- Member
- From: Argentina
- Registered: 2009-04-20
- Posts: 401
Re: [plugin] [ORPHAN] fpx_image_import
Hi. one question
What field does this plugin use for to order the images ?
(size, file name, date ?)
Thanks
Offline