• Resolved jamminjames

    (@jamminjames)


    You helped me set up a Uploader Instance a year ago or so that allows people to upload images to a NextGen gallery (thanks!). The code is:

    [wordpress_file_upload multiple="false" userdata="true" userdatalabel="Description|t:text|s:top|r:0|a:1|p:none|d:" nextgen="true" ngg_galleryid="18" ngg_description="%userdata1%" ngg_alttext="Humor Times, reader cartoon" ngg_tags="Reader cartoon" ngg_exclude="true"]

    The Upload Path is set as ‘uploads’, so would changing that to ‘gallery/user-cartoons’ fix the problem? That’s where they end up, but copies are left in the ‘uploads’ folder.

    Thank you.

    The page I need help with: [log in to see the link]

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author nickboss

    (@nickboss)

    Hi, copies are indeed left at /uploads. The plugin stores the originally uploaded files at the location defined by Upload Path attribute of the shortcode. You have the default value, which is /uploads. When adding files to a NextGEN gallery, it creates copies of the original files.

    There is no point of changing the upload path to gallery/user-cartoons. Copies will still be created.

    You can delete the files in /upload path if you don’t want them. I suppose the gallery images will remain (but make a check with some test files first).

    Regards

    Nickolas

    Thread Starter jamminjames

    (@jamminjames)

    How can I delete them programmically? Can that be done in the shortcode somehow?

    Plugin Author nickboss

    (@nickboss)

    It can be done with a hook, but I am not sure about the implications. Can you check first that there are not problems observed after you manually delete the files?

    Nickolas

    Thread Starter jamminjames

    (@jamminjames)

    Yes, I did that already, and the images stay put in the gallery.

    Plugin Author nickboss

    (@nickboss)

    Try the following hook.

    if (!function_exists('wfu_nextgen_add_files_custom')) {
    	function wfu_nextgen_add_files_custom($ret, $attr, $params) {
    		$ret = wfu_nextgen_add_files($ret, $attr, $params);
    		foreach ( $attr["files"] as $file ) unlink($file["filepath"]);
    		return $ret;
    	}
    	remove_filter('_wfu_after_upload', 'wfu_nextgen_add_files');
    	add_filter('_wfu_after_upload', 'wfu_nextgen_add_files_custom', 10, 3);
    }

    I haven’t tested it. Does it work?

    Nickolas

    Thread Starter jamminjames

    (@jamminjames)

    Tried it, not working, but see my email. I don’t have the NextGen functionality I had before I deleted the plugin to reinstall.

    Plugin Author nickboss

    (@nickboss)

    How had we implemented NextGEN functionality? through a hook? Do you remember?

    Nickolas

    Thread Starter jamminjames

    (@jamminjames)

    Thanks for sending me the zip with the NextGen functionality.

    If you haven’t yet, I would think it would be a big plus to make it a part of your regular release. A lot of people use NextGen, after all.

    I reinstalled and everything is back as it was. The hook you gave me to delete the duplicate file in Uploads worked perfectly, and the image stays in the NextGen folder.

    You are a genius, and very generous as well. Keep up the great work!

    The bad news is the php-fpm/error.log error with session_start() continues (“Cannot start session when headers already sent in /var/www/humortimes/wp-content/plugins/wordpress-file-upload-pro/wfu_loader.php on line 5”). Could it have something to do with the file being called with a ‘require_once’ line in wordpress_file_upload.php? If the cause can’t be found, can we put the problematic line 5 inside an ‘if’ statement, conditioning it on headers not being sent?

    Plugin Author nickboss

    (@nickboss)

    Actually NextGEN has become part of the regular release. Interoperability tab includes an option for NextGEN as well!

    Regarding session_start() issue, I am planning to change the whole way the plugin stores user state information, by migrating from session to cookies. So this message will vanish.

    For now, open wordpress_file_upload.php and check if there are any blank lines after the php closing tag (?>). If there are, delete them. Do the same for wfu_loader.php.

    Any change?

    Thread Starter jamminjames

    (@jamminjames)

    Great news on NextGen!

    Regarding the session, I had already checked those files, there were not any blank lines after the tags.

    Could it be that WordPress establishes a session already? I don’t see any previous reference to it in your files.

    Thread Starter jamminjames

    (@jamminjames)

    Thanks, now that I have the pro version restored, the hook you provided works perfectly, creating only one image copy, in the NextGen folder. For anyone reading this, the hook goes into the “Hooks” tab in the plugin itself.

    Plugin Author nickboss

    (@nickboss)

    Ok I am glad.

    Nickolas

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Using Uploader Instance, getting duplicate images in different folders’ is closed to new replies.