adrian

Custom Upload Names

Recommended Posts

On 11/22/2018 at 2:37 AM, simonsays said:

Hello ūüôā

Sorry, I haven't forgotten - just had other priorities get in the way - I'll try to take a look soon.

Share this post


Link to post
Share on other sites

@adrian Checking "Rename on Save" and inserting the image link inside textarea field via "Insert Link" and then "Select File" and finally saving the page it doesn't update the link. It always lead to the previous filename. Can you please fix it?

  • Like 1

Share this post


Link to post
Share on other sites
4 hours ago, PWaddict said:

@adrian Checking "Rename on Save" and inserting the image link inside textarea field via "Insert Link" and then "Select File" and finally saving the page it doesn't update the link. It always lead to the previous filename. Can you please fix it?

Any chance you are inserting into a multi-language textarea field? If so, then it should be fixed in the latest version. If not, please let me know and I can investigate further.

 

Share this post


Link to post
Share on other sites
40 minutes ago, adrian said:

Any chance you are inserting into a multi-language textarea field? If so, then it should be fixed in the latest version. If not, please let me know and I can investigate further.

 

I was testing it in a NON multi-language textarea field.

Share this post


Link to post
Share on other sites
11 minutes ago, PWaddict said:

I was testing it in a NON multi-language textarea field.

Are you in a repeater or anything else unusual?

Share this post


Link to post
Share on other sites
53 minutes ago, adrian said:

Any chance you are inserting into a multi-language textarea field? If so, then it should be fixed in the latest versionÔĽŅ.

I just tried it on a multi-language textarea field with the latest version (1.0.11) and it has the same problem.

5 minutes ago, adrian said:

Are you in a repeater or anything else unusual?

Nope

Share this post


Link to post
Share on other sites

If I understand correctly you've updated the part of the module that searches img tags inside textarea. The problem I'm having has nothing to do with img tags cause I do NOT  add the images inside textarea. I only add their LINKS via "Insert Link" and then "Select File".

  • Like 1

Share this post


Link to post
Share on other sites
2 minutes ago, PWaddict said:

I only add their LINKS via "Insert Link" and then "Select File".

Oh sorry, I missed that distinction. I'll see what I can do about supporting that situation.

  • Like 1

Share this post


Link to post
Share on other sites

@PWaddict - it should now work in the latest version.

@simonsays - I think all your repeater issues should also now be fixed - sorry again for the huge delay on this.

  • Like 2

Share this post


Link to post
Share on other sites
13 minutes ago, adrian said:

it should now work in the latest version.

Yep although adding image links on a textarea field that belongs to another page it doesn't update them.

  • Like 1

Share this post


Link to post
Share on other sites
12 hours ago, PWaddict said:

Yep although adding image links on a textarea field that belongs to another page it doesn't update them.

Good point. I am attaching a new version here for you to test. I don't have much time this morning to test it properly, but hopefully this will also handle that.

@simonsays - could also please test this version?

ProcessCustomUploadNames.zip

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, adrian said:

I am attaching a new version here for you to test.

It's almost perfect. There is only 1 small issue:

Assuming that you have 2 tabs open in your browser. The 1st tab has the page where you renaming the image and the 2nd tab has the page with the textarea field where you inserting the image link. If I save the page on the 1st tab and then save the page on the 2nd tab without refreshing it then the old link will be saved and it will never gets updated again until I manually go and select the link via "Insert Link > Select File".

Share this post


Link to post
Share on other sites
4 minutes ago, PWaddict said:

It's almost perfect. There is only 1 small issue:

Assuming that you have 2 tabs open in your browser. The 1st tab has the page where you renaming the image and the 2nd tab has the page with the textarea field where you inserting the image link. If I save the page on the 1st tab and then save the page on the 2nd tab without refreshing it then the old link will be saved and it will never gets updated again until I manually go and select the link via "Insert Link > Select File".

Not really sure that could be dealt with without maintaining a database of filename changes and associated page ids and checking against them whenever a page is changed. If you have a simple approach I am not thinking of, I'd be happy to implement.

Share this post


Link to post
Share on other sites
3 hours ago, adrian said:

Not really sure that could be dealt with without maintaining a database of filename changes and associated page ids and checking against them whenever a page is changed. If you have a simple approach I am not thinking of, I'd be happy to implement.

I've temporarily disabled the rule just to test with PW core function on image linking and it doesn't update image links even if the image and the textarea are on the same page.

EDIT: Should I open issue on GitHub?

Share this post


Link to post
Share on other sites
5 hours ago, adrian said:

ProcessCustomUploadNames.zip

On this version if the image and the textarea are on the same page the image links are not updated. On the 1.0.13 it works ok.

Share this post


Link to post
Share on other sites
41 minutes ago, PWaddict said:

On this version if the image and the textarea are on the same page the image links are not updated. On the 1.0.13 it works ok.

Strange - it seems to be working here. Is there something in your setup that differs from this?

jwZGw4sPhN.thumb.gif.f077a0949d38a3511639a00e8d2dd7ae.gif

Share this post


Link to post
Share on other sites
45 minutes ago, adrian said:

Strange - it seems to be working here. Is there something in your setup that differs from this?

No. I reinstalled the unreleased version again and it's working now but I've noticed that it doesn't always rename the filename when I save the page. On Filename format I'm using this $page->title-[Y-m-d_H-i-s] so I would know if image is renamed. Keep saving the page again and again and you'll notice the issue.

Share this post


Link to post
Share on other sites

@adrian If I use this: [Y-m-d_H-i-s]-$page->title the filename ALWAYS renamed on save but if I use this $page->title-[Y-m-d_H-i-s] or this [Y-m-d_H-i-s] it doesn't.

  • Like 1

Share this post


Link to post
Share on other sites
1 minute ago, PWaddict said:

@adrian If I use this: [Y-m-d_H-i-s]-$page->title the filename ALWAYS renamed on save but if I use this $page->title-[Y-m-d_H-i-s] or this [Y-m-d_H-i-s] it doesn't.

Thanks for the debugging. That actually makes sense because I have a check to not rename files with "-n" extensions because PW's automatic adding of "-n" when there is already a file of the same name. I'll have to see if I can sort out a workaround for this, but I won't be able to look until tomorrow.

  • Like 1

Share this post


Link to post
Share on other sites
23 minutes ago, adrian said:

Thanks for the debugging. That actually makes sense because I have a check to not rename files with "-n" extensions because PW's automatic adding of "-n" when there is already a file of the same name. I'll have to see if I can sort out a workaround for this, but I won't be able to look until tomorrow.

Maybe you should allow the date format [Y-m-d_H-i-s] & $file->mtime starting with underscore "_" instead of dash "-".

Share this post


Link to post
Share on other sites
On 11/25/2018 at 9:40 AM, PWaddict said:

Maybe you should allow the date format [Y-m-d_H-i-s] & $file->mtime starting with underscore "_" instead of dash "-".

You should be able to specify any PHP date() format you want - if you want to replace those dashes with underscores you can. I think that should take care of the conflict with the "-n" suffix check.

Share this post


Link to post
Share on other sites
36 minutes ago, adrian said:

You should be able to specify any PHP date() format you want - if you want to replace those dashes with underscores you can. I think that should take care of the conflict with the "-n" suffix check.

A dot must be used between fields to work properly and yes about the php date underscores inside the brackets is the solution:

$page->title.[Y_m_d_H_i_s]

$page->title.$file->mtime

Don't forget to update the module with the proper version you posted above and also add the above examples in Rename Rules description. THANKS A LOT ūüôā

Share this post


Link to post
Share on other sites
1 minute ago, PWaddict said:

A dot must be used between fields to work properly

I use curly braces, like this:

{$page->title}-[Y_m_d_H_i_s]

 

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Robin S
      Another little admin helper module...
      Template Field Widths
      Adds a "Field widths" field to Edit Template that allows you to quickly set the widths of inputfields in the template.

      Why?
      When setting up a new template or trying out different field layouts I find it a bit slow and tedious to have to open each field individually in a modal just to set the width. This module speeds up the process.
      Installation
      Install the Template Field Widths module.
      Config options
      You can set the default presentation of the "Field widths" field to collapsed or open. You can choose Name or Label as the primary identifier shown for the field. The unchosen alternative will become the title attribute shown on hover. You can choose to show the original field width next to the template context field width.  
      https://github.com/Toutouwai/TemplateFieldWidths
      https://modules.processwire.com/modules/template-field-widths/
    • By horst
      Croppable Image 3
      for PW 3.0.20+
      Module Version 1.1.16
      Sponsored by http://dreikon.de/, many thanks Timo & Niko!
      You can get it in the modules directory!
      Please refer to the readme on github for instructions.
       
      -------------------------------------------------------------------------
       
      Updating from prior versions:
       
      Updating from Croppable Image 3 with versions prior to 1.1.7, please do this as a one time step:
      In the PW Admin, go to side -> modules -> new, use "install via ClassName" and use CroppableImage3 for the Module Class Name. This will update your existing CroppableImage3 module sub directory, even if it is called a new install. After that, the module will be recogniced by the PW updater module, what makes it a lot easier on further updates.
      -------------------------------------------------------------------------
       
      For updating from the legacy Thumbnail / CropImage to CroppableImage3 read on here.
       
      -------------------------------------------------------------------------
       
    • By MoritzLost
      UPDATE: I have published a stable version of this module!
      Discussion thread:
      Github: https://github.com/MoritzLost/TextformatterPageTitleLinks
      ---
      Hello there,
      I'm working on a tiny textformatter module that searches the text for titles of other pages on your site and creates hyperlinks to them. I'm not sure if something like this exists already, but I haven't found anything in the module directory, so I wrote my own solution ūüôā
      It's not properly tested yet and is still missing some functionality I would like to implement, so at the moment it should be considered in BETA. Features include limiting the pages that will get searched by template, and adding a custom CSS class to the generated hyperlinks. As I'm writing this I noticed that it will probably include unpublished and hidden pages at the moment, so yeah ... it's still in development alright ūüėÖ
      You can download the module from Github:
      https://github.com/MoritzLost/TextformatterPageTitleLinks
      There's some more information in the readme as well.
      Anyway, let me know what you think! I'm happy about any feedback, possible improvements or ideas on how to improve the module. Cheers.
    • By blad
      Hi guys!
      I just uploaded a module to explore files based on elFinder. By default it will show the "Files" folder.
      Screenshots:

      Video:
       
      To do:
       More options To fix:
       The function of rotating or scaling an image fails  Image editors V 1.01 (view issue)
      Fixed the bug working with the Multi-Language support ( translation of folders ). Fixed the name of elfinder.en  Github:
      https://github.com/LuisSantiago/ProcessElFinder/
      I hope you like it.
    • By BitPoet
      I'm really in love with FormBuilder, but the one thing missing to match all my end users' expectations were repeatable field groups. Think repeaters, in ProcessWire terms. Our primary application of PW is our corporate intranet, so "lines" of fields are quite common in the forms I build. We have all kinds of request forms where the information for a varying number of colleagues needs to be entered (from meal order to flight booking request) and where it is simply impractical to send a form for each, and I don't want to clutter my forms with multiple instances of fields that may only get used ten percent of the time.
      That's why I started to build FormBuilderMultiplier (link to GitHub).
      What it does:
      Adds an option to make a regular Fieldgroup repeatable Lets you limit the number of instances of a Fieldgroup on the form Adds an "Add row" button the form that adds another instance of the Fieldgroup's fields Adds a counter suffix at the end of every affected field's label Stores the entered values just like regular fields Makes the entered values available in preview and email notifications Supports most text based fields, textareas and selects (really, I haven't had enough time to test all the available choices yet) What it doesn't do (yet):
      Support saving to ProcessWire pages (i.e. real Repeaters) I haven't tested all the validation stuff, Date/Time inputs etc. yet, but since I'm utterly swamped with other stuff at work, I didn't want to wait until I have it polished. Any feedback is welcome. There might also be some issues with different output frameworks that I haven't encountered yet. The forms I work with mostly use UIKit.
      Status:
      Still alpha, so test well before using it in the field.
      Known issues:
      When rows are added, the form's iframe needs to be resized, which isn't completely clean yet.
      How it works:
      The Fieldgroup settings are added through regular hooks, as is the logic that adds the necessary field copies for processing the form and displaying previews.
      "Multiplied" field instances are suffixed with _NUM, where NUM is an incremental integer starting from 1. So if you have add two fields named "surname" and "givenname" to a fieldgroup and check the "multiply" checkbox, the form will initially have "surname_1" and "givenname_1" field (I'm still considering changing that to make the risk to shoot oneself into the foot by having a regular "surname_1" field somewhere else in the form less likely).
      When a "row" is added, the first row is cloned through JS and the counter in the fields' IDs, names and "for" attributes as well as the counter in the label are incremented before appending the copies to the Fieldset container in the form.
      To keep backend and frontend in sync, a hidden field named [name of the fieldset]__multiplier_rows is added to the form. Both the backend and the frontend script use this to store and retrieve the number of "rows".
      ToDo:
      Naturally, add the option to store the data in real repeaters when saving to pages. Do a lot of testing (and likely fixing). Make a few things (like the "Add row" button label etc.) configurable in field(set) context. Add a smooth API to retrieve the multiplied values as WireArrays. The mandatory moving screenshot: