WordPress.org

Ready to get started?Download WordPress

Forums

Custom Upload Dir
[resolved] Search and mobile apps compatibility (10 posts)

  1. owh
    Member
    Posted 1 year ago #

    Hi, this is a wonderful plugin. Thank you very much!

    I would like to ask if there are ways to:

    1.
    Search for image from a specified folder.

    Example: I have set upload dir to %postname%. That way helps me to "organize". This satisfied half of my need -- to feel organized. However, the other half of the benefit of being organized -- to ease retrieval is not satisfied. When I want to use an image from a specific post, it will be useful to be able to retrieve the image from within the Add Media dialog box by searching for (or browsing for) the post name, e.g. "visit to france". I can't find this ability in WordPress's Add Media dialog. Is there anyway to achieve this?

    2.
    Work from mobile version of WordPress (iOS and Android apps).

    I do adhoc posting from my mobile devices. It seems WordPress plugins do not work in them. Am I right? So, images uploaded from mobile devices remain not organized :). Any workaround?

    Again, thank you very much for this great plugin.

    http://wordpress.org/extend/plugins/custom-upload-dir/

  2. ulfben
    Member
    Plugin Author

    Posted 1 year ago #

    1. there are probably plugins out there modifying the Media-dialogue to your liking. It's out of the scope of Custom Upload Dir.

    2. are you talking about the WordPress app? I've never used it for anything serious, but I can't see why using the mobile front end would affect the plugins. This is likely a problem with the plugin.

    Please test file uploads from the mobile app some more. Make sure you've named and saved the post draft before uploading anything to it.

  3. owh
    Member
    Posted 1 year ago #

    Sorry that I was not able to get back on this earlier.

    I tested upload from WordPress iOS (iPhone app) and Android app, and they didn't work with Custom Upload Dir (and probably other plugins too). The images were uploaded to WP default upload folder. I also tested from Windows Live Writer, the images were uploaded to WP default folder.

    I guess this has to do with the way tools (iOS, Android apps and WLW) handle image upload. Hopefully someone will come up with tools that can organize media in better way. I am now stuck in between (1) hang on to WP editor to get the beauty of Custom Upload Dir plugin, and forget about other tools, (2) live with different ways different tools organize my media. Sigh.

    Thanks for this great plugin again.

  4. ulfben
    Member
    Plugin Author

    Posted 1 year ago #

    I'll try and research this when I get some plugin time next, and see what causes the difference. WordPress shouldn't behave inconsistently depending on what front-end you use.

  5. owh
    Member
    Posted 1 year ago #

    Many thanks! That will be wonderful. Right now, the pics uploaded from posts created on my mobile devices and WLW are not organized. Waiting for the fix.

    I wonder if doing a 'post' organization will make it reliably 'front-end' independent. That means, let the post be created and media uploaded 'naturally' by WordPress. Then a 'post' organization will be triggered either automatically at some point or manually, which will check the newly created posts/pages to organize the media, i.e. move them and update database. At the moment, I do this manually with the post I created in Windows Live Writer (WLW) since I can't find anything to help with this. WLW is easiest to deal with post with many many photos -- drag and drop multiple photos (in WP, multiple photos can be uploaded but each has to be inserted one by one). Once I created the post, I use FTP client to create a folder with post name (in consistent with Custom Upload Dir), move all photos into this folder. Then use Search and Replace to update corresponding URLs in database. It's tedious, so I only do for large posts. Smaller posts esp from mobile devices have their media not organized. I wish I have the ability to 'program' the above ability, but I don't. Sorry for the long story.

  6. ulfben
    Member
    Plugin Author

    Posted 1 year ago #

    Turns out there's a huge difference between ordinary uploads and XMLRPC-uploads. When posting from an app the upload starts at mw_newMediaObject, flows through wp_upload_bits and ends with letting us filter on wp_handle_upload.

    Note; it doesn't run wp_handle_upload (only the filters), since mw_newMediaObject does the same work. That's why Custom Upload Dir wouldn't filter uploads from WordPress apps.

    Problem is though - no matter where you hook into the RPC flow, there is no context of a post. Not unless the XMLRPC call included a post_id in it's arguments. WP Core has code for that event, but it never happened once during all my testing.

    Still - I added support for it to my plugin so now we've got:

    1. Custom Upload Dir will filter uploads from all WordPress apps.
    2. Any placeholders relating to posts are unreliable (assume not working).

    Thus

    %file_ext% => The file extension
    %year% => The year (YYYY)
    %monthnum% => The month (MM)
    %day% => The day (DD)
    %current_user% => The currently logged in user

    Should all work. Whereas

    %post_id% => The post ID
    %author% => The post author
    %postname% => The post's URL slug
    %parent_name% => The parent URL slug
    %post_type% => (post|page|attachment)
    %permalink% => Match your blog's permalink structure
    %category% => The post's categories (see: Taxonomies)
    %post_tag% => The post's tags (see: Taxonomies)

    Probably wont. Unless your app includes post_id in its arguments.

    These changes will be added to the next release, tomorrow.

  7. owh
    Member
    Posted 1 year ago #

    Thanks a lot for working on it!

    It took me a while to digest the technical details and I am still in indigestion. I gathered that the mobile apps do not supply post specific information for plugin to use. Indeed I tested on iOS and Android and post specific placeholders are ignored. However, these are the crucial information to get organized (e.g. postname).

    This highlight another shortcoming of WordPress mobile apps. I had highlighted their limited ability in handling images in the iOS WordPress forum earlier. Perhaps I will share this finding in their forum. In fact, I have been avoiding posting from my mobile devices as I prefer my media to be organized by Custom Upload Dir. Also, there are other limitations in the way mobile apps upload images.

    Ideally the mobile apps should address this problem as many other plugins will benefit from the supplied information. I think at the moment most plugins don't address the need of mobile posting, while only focus on the need of displaying content on mobile devices (which is still very challenging). May be a rather dumb idea from me, I wonder if it is possible to handle the issue by allowing "post operation" (post in the sense of afterward, as opposed to pre). Those upload with missing post specific placeholders will be recorded, allowed to upload in parent folder (e.g. upload/) and then find out which post they have been attached, and then move them to subfolder based on specified placeholders. I guess the most complicated task will be to then update the url in the post. In a way, this approach will be independent of how front end work, may be.

    Thanks again for the great plugin! It's definitely an important one in my workflow.

  8. owh
    Member
    Posted 1 year ago #

    And perhaps that dumb idea I suggested would also address the issue of users who already have tons of medias littered by WordPress in the upload folders. And, even allowing users to change path template and "upload" the filesystem. There will be no hesitation to use this plugin to get organized.

    Thanks again!

  9. ulfben
    Member
    Plugin Author

    Posted 1 year ago #

    I would love if WordPress core provided some useful APIs for managing the filesystem and automatically having changes reflected in the database. But I know that's pretty unrealistic - the filesystem is a dark and mysterious place, and matching filesystem updates to URLs in plain text posts would be a can of worms.

    If they simply provides post_id with every XMLRPC interaction we'd be golden.

  10. owh
    Member
    Posted 1 year ago #

    I can understand that. I have seen other plugins making unsuccessful attempts. Guess it is not a good idea to mess with the filesystem. Still Custom Upload Dir has done right what it is intended. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.