Alpine418 Posted April 30, 2021 Share Posted April 30, 2021 On 4/27/2021 at 5:43 AM, Kiwi Chris said: This module works well, but with Lister Pro and inline editing within the Lister Pro table, even with the check box to update on save for this module, file names aren't renamed, although opening via a full edit and saving does work. I suspect the issue might be the way Lister Pro works, but if it's possible to get this module to work with inline editing mode in Lister Pro it would be handy. Looks like the same issue I have with page repeater. It would be really cool to get this supported. Link to comment Share on other sites More sharing options...
PWaddict Posted April 30, 2021 Share Posted April 30, 2021 Hi @adrian With the 1.3.1 version when I try to save more than 1 repeater fields I'm getting this: Look out… Fatal Error: Uncaught Error: Call to a member function isTemp() on null in site/modules/ProcessCustomUploadNames/ProcessCustomUploadNames.module.php:414 #0 site/modules/ProcessCustomUploadNames/ProcessCustomUploadNames.module.php(225): ProcessCustomUploadNames->createNewFilename('/home/myusername...', 'myimage-16198119...', '', Object(Page), '287', Object(RepeaterPage)) #1 wire/core/Wire.php (397): ProcessCustomUploadNames->customRenameUploads(Object(HookEvent)) #2 wire/core/WireHooks.php (927): Wire->_callMethod('customRenameUpl...', Array) #3 wire/core/Wire.php (465): WireHooks->runHooks(Object(Pages), 'saved', Array) #4 wire/core/PagesEditor.php (746): Wire->__call('saved', Array) #5 /home/myusername/publ (line 414 of site/modules/ProcessCustomUploadNames/ProcessCustomUploadNames.module.php) Link to comment Share on other sites More sharing options...
PWaddict Posted April 30, 2021 Share Posted April 30, 2021 I switched to this version (18 Feb 2021) and I can save more than 1 repeater fields without any issues. Link to comment Share on other sites More sharing options...
PWaddict Posted May 11, 2021 Share Posted May 11, 2021 Actually, I had to switched to an even older version 1.2.10 (24 Nov 2020) cause the 1.2.11 and 1.2.12 was generating duplicate images. The 1.2.10 is the most reliable version so I'm gonna stay with it until the 1.3.1 gets fixed. Link to comment Share on other sites More sharing options...
adrian Posted May 11, 2021 Author Share Posted May 11, 2021 6 hours ago, PWaddict said: cause the 1.2.11 and 1.2.12 was generating duplicate images Was this just in a repeater scenario? I have been using the latest version extensively without any problems (and it solves lots of other issues), so I am assuming this is repeater specific? I'll try to take a look shortly. Sorry, I haven't had much time for module maintenance lately. Link to comment Share on other sites More sharing options...
PWaddict Posted May 11, 2021 Share Posted May 11, 2021 19 minutes ago, adrian said: Was this just in a repeater scenario? This was in a non-repeater. The duplicated images were generated on the 1.2.11 and 1.2.12 versions after uploading multiple images. I don't know if this happens on repeater too. 25 minutes ago, adrian said: I have been using the latest version extensively without any problems (and it solves lots of other issues), so I am assuming this is repeater specific? The fatal error I'm getting with the 1.3.1 version is when I try to save more than 1 repeater fields. I didn't have problems on non-repeaters. 27 minutes ago, adrian said: I'll try to take a look shortly. Sorry, I haven't had much time for module maintenance lately. No worries. Link to comment Share on other sites More sharing options...
adrian Posted May 12, 2021 Author Share Posted May 12, 2021 @PWaddict - I have been trying to reproduce the issue with repeaters but can't so far. I have a feeling the duplicate image issue might not exist in 1.3.1 so I want to work on the repeater issue first and see if that fixes everything for you. Can you please provide all the repeater field settings, the image field settings, and the CUN settings. There must be some combination I am not trying. Link to comment Share on other sites More sharing options...
PWaddict Posted May 12, 2021 Share Posted May 12, 2021 38 minutes ago, adrian said: Can you please provide all the repeater field settings, the image field settings, and the CUN settings. There must be some combination I am not trying. Here are the settings for the repeater: Here are the settings (Details & Input) for the image field (Croppable Image 3): Here are the settings for Custom Upload Names: I don't know if it matters but here are the settings for Auto Smush: Make sure you have the 1.3.1 version installed of Custom Upload Names. The fatal error is happening if you try to edit already published more than 1 repeater pages and also when you try to create more than 1 new repeater pages. 1 Link to comment Share on other sites More sharing options...
adrian Posted May 12, 2021 Author Share Posted May 12, 2021 Thanks @PWaddict - that helped a lot. Should hopefully be fixed in the latest version. 1 Link to comment Share on other sites More sharing options...
adrian Posted May 13, 2021 Author Share Posted May 13, 2021 On 4/26/2021 at 8:43 PM, Kiwi Chris said: This module works well, but with Lister Pro and inline editing within the Lister Pro table, even with the check box to update on save for this module, file names aren't renamed, although opening via a full edit and saving does work. I suspect the issue might be the way Lister Pro works, but if it's possible to get this module to work with inline editing mode in Lister Pro it would be handy. The reason is because ListerPro uses the saveField() when only field in the row is changed. If you edit two fields, then the rename will work because ListerPro then uses save() - you can see this starting on line 631 of the main ListerPro module file. It should be possible to make CUN work with this by adding a new hook to Pages::saveField. I have this working but I think I need to test more for other possible side effects. If you'd like to help test, you can place: $this->addHookBefore('Pages::saveField', $this, 'customRenameUploads'); after this line: https://github.com/adrianbj/CustomUploadNames/blob/67b1d42aef4c23be92684420f0d282c0c4a9a8d4/ProcessCustomUploadNames.module.php#L101 Let me know how it goes for you. 1 Link to comment Share on other sites More sharing options...
PWaddict Posted May 13, 2021 Share Posted May 13, 2021 5 hours ago, adrian said: Thanks @PWaddict - that helped a lot. Should hopefully be fixed in the latest version. Yep, problem is gone. Thank you very much. 1 Link to comment Share on other sites More sharing options...
Rostik RODE Posted May 18, 2021 Share Posted May 18, 2021 I am having issues with a repeater as well. When I add an image it changes its name to "filename-upload-tmp", and not to the setting I have set up in the module. I updated to the latest version of the module, that didn't fix it. Seems like the issue is only for the images in the repeater. Link to comment Share on other sites More sharing options...
adrian Posted May 18, 2021 Author Share Posted May 18, 2021 1 minute ago, Rostik RODE said: I am having issues with a repeater as well. When I add an image it changes its name to "filename-upload-tmp", and not to the setting I have set up in the module. I updated to the latest version of the module, that didn't fix it. Seems like the issue is only for the images in the repeater. Did it work fully with older versions of the module? The problem is not actually repeater specific - the upload-tmp suffix is because the naming rule you defined relies on a field that isn't populated at the point when the image is uploaded. Obviously this happens in most situations with repeaters, but it will also happen with regular pages in that situation. Can you share your settings like PWAddict did? Link to comment Share on other sites More sharing options...
Rostik RODE Posted May 18, 2021 Share Posted May 18, 2021 Here are my settings I havent tried an older version of the module on this specific site, but I used it on another sites with exact same setups, and didn't have any issues. Thanks for your help! Link to comment Share on other sites More sharing options...
adrian Posted May 18, 2021 Author Share Posted May 18, 2021 Thanks @Rostik RODE - I just tested those settings and can't reproduce the issue you are seeing. Any chance the title field for the page somehow isn't set when the image is uploaded? Usually this is unlikely because title is required and the first thing that is set when creating a new page, but that it really the only reason I can think of for the upload-tmp suffix being added - it's there so that the module knows that file needs to be renamed later, once that field value is available. Link to comment Share on other sites More sharing options...
Rostik RODE Posted May 18, 2021 Share Posted May 18, 2021 Title is there, and there are other image fields in the same template that rename correctly without any issues. Only repeater field is affected. Thanks for your help Link to comment Share on other sites More sharing options...
Rostik RODE Posted May 18, 2021 Share Posted May 18, 2021 also, i updated to latest pw dev 3.0.178, issue is still there Link to comment Share on other sites More sharing options...
adrian Posted May 18, 2021 Author Share Posted May 18, 2021 Sorry @Rostik RODE - I am at a bit of a loss - still can't reproduce. Any chance you could share a login to the site so I can test? Are there any other modules / hooks that might be interfering with image naming? or anything else you can think of? Link to comment Share on other sites More sharing options...
Rostik RODE Posted May 18, 2021 Share Posted May 18, 2021 thanks for your help! its not that big of a deal, not worth spending too much time. i cant think of why it wouldn't work just for that one repeater. i have another repeater, where its a single image, so same image field but with a limit of 1 file in place, and it works correctly. so perhaps it something to do with that Link to comment Share on other sites More sharing options...
adrian Posted May 18, 2021 Author Share Posted May 18, 2021 3 minutes ago, Rostik RODE said: i have another repeater, where its a single image, so same image field but with a limit of 1 file in place, and it works correctly. so perhaps it something to do with that I did my test with a multiple images field (max: 0) just like in your screenshot. It might be helpful if you could test on another template / repeater field setup with support for multiple images and see if you can narrow it down. If you've got a setup that doesn't work, I am sure others will come across this at some point as well. Link to comment Share on other sites More sharing options...
Studio Lambelet Posted June 24, 2022 Share Posted June 24, 2022 (edited) Hey @adrian, thanks for the great module! I have an issue with .webp files, they are not renamed at all on page save. JPG are renamed without any problem. What could I do to find a solution to this ? Using PW v3.0.200, PHP 8.1, no errors in Tracy. Edited June 24, 2022 by Studio Lambelet Clarification, added screenshot. Link to comment Share on other sites More sharing options...
Pete Posted July 28, 2022 Share Posted July 28, 2022 I encountered an odd error today and I cannot for the life of me work out what caused it: However I added !is_null($fieldObject) before the count on the line in question (and the other 2 places that same piece of code crops up) and that sorted it. For whatever reason the field object was null. EDIT: Ah - I think this is a PHP8 thing actually which explains why it was working last week and not this week - that's probably it ? 1 Link to comment Share on other sites More sharing options...
zoeck Posted July 28, 2022 Share Posted July 28, 2022 37 minutes ago, Pete said: EDIT: Ah - I think this is a PHP8 thing actually which explains why it was working last week and not this week - that's probably it ? Changelog Version Description 8.0.0 count() will now throw TypeError on invalid countable types passed to the value parameter. 7.2.0 count() will now yield a warning on invalid countable types passed to the value parameter. https://www.php.net/manual/en/function.count.php? 2 Link to comment Share on other sites More sharing options...
adrian Posted July 28, 2022 Author Share Posted July 28, 2022 Thanks @Pete - I've been running that module on PHP 8 - surprised I hadn't come across the error before. Should be fixed now! 1 Link to comment Share on other sites More sharing options...
LAPS Posted February 20, 2023 Share Posted February 20, 2023 Hi @adrian, I would like to use this module for auto-renaming the profile image of users when using the LoginRegisterPro module. Two things: In the module settings, the "Enabled Templates" option hasn't the user template as a selectable option. Note: in my case I think selecting by template is better than selecting by pages ("Enabled Pages" option) because I've users under multiple parents. The module seems do not work for the LoginRegisterPro profile action/form. Any help? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now