Jump to content
adrian

Custom Upload Names

Recommended Posts

@adrian

My settings: Enable fields -> images, Filename format: site-{$page->name}, Rename on save is ON.

If page->name = 'high-7' I lost one of file every save.

I fix it with: site-{$page->name}-### 

Now everything except lightning.pw works fine.

After submit new password on https://lightning.pw/login/change_password I get Safari can’t open the page “https://lightning.pw/login/change_password” because the server unexpectedly dropped the connection. This sometimes occurs when the server is busy. 

Thanks for your help!

Share this post


Link to post
Share on other sites

Thanks for the details. I think it must be a combination of the number in the page name and the "Rename on Save" setting. I am glad the custom ### option fixes it for you though :)

I still can't reproduce it here though, so just curious, what version of PW and CUN are you running? 

  • Like 1

Share this post


Link to post
Share on other sites
Hi @adrian, 
 
I have another strange issue. Some of images has new file name on the server but old name on the page.
 
Maybe you have an idea why it can be happens and how is possible to solve this?

Share this post


Link to post
Share on other sites
Hi @adrian, 
 
I have another strange issue. Some of images has new file name on the server but old name on the page.
 
Maybe you have an idea why it can be happens and how is possible to solve this?

Are you still using the "Rename on Save" option? That is likely the culprit, although I am not completely sure why. Obviously I would like to get that completely reliable, but in the meantime, do you actually need it? If you are setting the name of the image based on $page->name and you don't have anyway of changing the name of a page when the title is changed (the default behavior in PW), then I don't think there is much point to that setting in your case.

Just to confirm, is it the name of the image in the images field, or embedded into an RTE, or both?

Is it random or can you give me a way to reliably reproduce it?

Share this post


Link to post
Share on other sites
Dear Adrian, thank you for reply.
 
I use Rename on Save because I need it for API (for front-end photos uploading).
 
For this moment more than 100 pages affected, so I make copy from old backup and now copy each files back to actual server. (every page have 10-20 photos, so it's long story :)
 
But I realise moment, when all this happened.
 
I use this code to make changes for page field (I mean, field type page):
$chalets = wire('pages')->find("template=chalet, chalet_dining.id=13664, include=all");

foreach ($chalets as $page) {
			$page->of( false );
			$page->set("chalet_dining", 13668);
			wire( 'pages' )->save( $page );
			$page->of( true );
			echo $page->title;
}

After that all images on server get new names, but in database they still with previous file names.

And I wish you good luck with new Padloper!

Share this post


Link to post
Share on other sites

Sorry, I don't have much time right now to test your page field scenario, but in general you shouldn't need "Rename on Save" to make it work for API uploading. I just tested to confirm, and everything still works for me when adding an image like: 

$page->images->add("http://myserver.com/image.jpg");
$page->of(false);
$page->save();

What happens if you don't use "Rename on Save" at your end?

I'd really like to help you debug this when I have a few spare minutes, but it seems like I will need to replicate your page field setup - maybe you could create a site profile that I could test with?

Padloper is actually by @apeisa, but I am sure he'll appreciate your best wishes :)

Share this post


Link to post
Share on other sites

@adrian,

Let's leave this for the next week when my colleague, who take care about front-end come back from vacation.

And now I know that

@adrian

@apeisa

not mirrored nicknames or same person  :-[

Share this post


Link to post
Share on other sites

@adrian,

Let's leave this for the next week when my colleague, who take care about front-end come back from vacation.

Sounds good - please follow up with me when he is back - hopefully I can reproduce the issues you are having.

Share this post


Link to post
Share on other sites

Thanks for the report @ukyo - sorry that you and Ryan spent time debugging this.

I have committed a new version which appears to fix the problem for me.

Could you please test and let me know if it now works for you?

If anyone is interested in what the problem was, take a read of the Github issue.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for quick response. It look like ok now.

I tested it with default (3) ready to use fields.

  • Like 1

Share this post


Link to post
Share on other sites

Hi everyone, I just added multi-language support to this module.

I use it with alternate language file fields for translated versions of PDFs.

In my example, I have these two fields:

  • document_pdf
  • document_pdf_portugues

I am using this filename format setting: {$page->title}

Now when I upload, the PDF gets renamed to match the title of the page based on the language suffix of the field, eg.

a page with these multi-language titles:

My Document Title (default) | Meu Título do Documento (portugues)

results in pdfs named:

my-document-title.pdf |  meu-título-do-documento.pdf

Please note that I am still pretty new to this multi-language stuff, so let me know if you have any problems or have ideas for improvements.

 

 

  • Like 2

Share this post


Link to post
Share on other sites

Hi,

I got an error

Error: Call to a member function get() on a non-object (line 346 of DIR_\site\assets\cache\FileCompiler\site\modules\ProcessCustomUploadNames\ProcessCustomUploadNames.module) 

After installing 'language support' it works...

Grtz 

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, videokid said:

Hi,

I got an error


Error: Call to a member function get() on a non-object (line 346 of DIR_\site\assets\cache\FileCompiler\site\modules\ProcessCustomUploadNames\ProcessCustomUploadNames.module) 

After installing 'language support' it works...

Sorry about that - it should be fixed in the latest version.

  • Like 1

Share this post


Link to post
Share on other sites

No sorry needed :-)

After reading ' multi-language support', I had the feeling the problem was somewhere there, just wanted to notify you about this....

  • Like 1

Share this post


Link to post
Share on other sites
Just now, videokid said:

No sorry needed :-)

After reading ' multi-language support', I had the feeling the problem was somewhere there, just wanted to notify you about this....

It's a very important fix though - I wouldn't want to break anyone's non ML site if they upgraded to the latest version of this module, so very glad you reported this.

  • Like 2

Share this post


Link to post
Share on other sites

@JoZ3 - sorry about the trouble - what version of the module did you upgrade from? That curly brace was added for PHP7, and I tested on 5.6, but maybe there is a problem with 5.3.

I am sure I can write it a little differently to avoid the problem on 5.3, but just want to make sure that's definitely the issue.

Share this post


Link to post
Share on other sites
34 minutes ago, JoZ3 said:

Thanks mate, works fine!!!!!

Great - I have pushed that version to Github.

  • Like 2

Share this post


Link to post
Share on other sites

Hi @adrian can you add support for CROPPABLE IMAGE 3 module. If i add croppable image 3 field to custom upload names filter, when i want to upload file upload progress not finishing. Also i will put this problem link to Croppable Image 3 module post, because i don't know which module causing this error.

Ekran Resmi 2016-10-13 18.18.26.png

When i refresh page without save page, i can see these pictures names changed and uploaded.

Share this post


Link to post
Share on other sites

I'll take a look, but can you first post a screenshot of your settings for this module and also any dev console Network tab errors coming from the upload ajax request?

  • Like 1

Share this post


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

I'll take a look, but can you first post a screenshot of your settings for this module and also any dev console Network tab errors coming from the upload ajax request?

Sorry for early post before check console errors. Its look like error causing from Croppable Image 3 module. When i check ajax request there is an error:

Notice: Trying to get property of non-object in /website/site/modules/CroppableImage3/InputfieldCroppableImage3/InputfieldCroppableImage3.module on line 139

Ekran Resmi 2016-10-13 18.52.36.png

Ekran Resmi 2016-10-13 18.52.23.png

File: site/modules/CroppableImage3/InputfieldCroppableImage3/InputfieldCroppableImage3.module

$attr['data-image'] = $pagefile->getCrop($suffix)->url;

I think the module can't get data, because name is changed.

Here is custom upload names module filter settings :

Ekran Resmi 2016-10-13 18.50.35.png

  • Like 1

Share this post


Link to post
Share on other sites

Hi @ukyo - thanks for those details. Unfortunately I can't reproduce the problem here.

I put this Tracy dump call just before line 139 (as reported in the error):

bd($pagefile->getCrop($suffix)->url);

and it is correctly reporting the url to the cropped version of the file.

Perhaps there is a certain sequence of events that is required to trigger the error. Could you please detail exactly the steps involved starting from a new images field, including the crop settings you have configured for the field.

 

  • Like 1

Share this post


Link to post
Share on other sites

@adrian & @ukyo: I'm not aware of any upload processing done by CroppableImage3. It only extends the coreimage field in some points, but nothing in regard of uploading.

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By teppo
      This module tracks changes, additions, removals etc. of public (as in "not under admin") pages of your site. Like it's name says, it doesn't attempt to be a version control system or anything like that - just a log of what's happened.
      At the moment it's still a work in progress and will most likely be a victim of many ruthless this-won't-work-let's-try-that-instead cycles, but I believe I've nailed basic functionality well enough to post it here.. so, once again, I'll be happy to hear any comments you folks can provide
      https://modules.processwire.com/modules/process-changelog/
      https://github.com/teppokoivula/ProcessChangelog
      How does it work?
      Exactly like it's (sort of) predecessor, Process Changelog actually consists of two modules: Process Changelog and Process Changelog Hooks. Hooks module exists only to serve main module by hooking into various functions within Pages class, collecting data of performed operations, refining it and keeping up a log of events in it's own custom database table (process_changelog.) Visible part is managed by Process Changelog, which provides users a (relatively) pretty view of the contents of said log table.
      How do you use it?
      When installed this module adds new page called Changelog under Admin > Setup which provides you with a table view of collected data and basic filtering tools See attached screenshots to get a general idea about what that page should look like after a while.
      For detailed installation instructions etc. see README.md.
       


    • By Gadgetto
      Status update links (inside this thread) for SnipWire development will be always posted here:
      2019-08-08
      2019-06-15
      2019-06-02
      2019-05-25
      If you are interested, you can test the current state of development:
      https://github.com/gadgetto/SnipWire
      Please note that the software is not yet intended for use in a production system (alpha version).
      If you like, you can also submit feature requests and suggestions for improvement. I also accept pull requests.
      ---- INITIAL POST FROM 2019-05-25 ----
      I wanted to let you know that I am currently working on a new ProcessWire module that fully integrates the Snipcart Shopping Cart System into ProcessWire. (this is a customer project, so I had to postpone the development of my other module GroupMailer).
      The new module SnipWire offers full integration of the Snipcart Shopping Cart System into ProcessWire.
      Here are some highlights:
      simple setup with (optional) pre-installed templates, product fields, sample products (quasi a complete shop system to get started immediately) store dashboard with all data from the snipcart system (no change to the snipcart dashboard itself required) Integrated REST API for controlling and querying snipcart data webhooks to trigger events from Snipcart (new order, new customer, etc.) multi currency support self-defined/configurable tax rates etc. Development is already well advanced and I plan to release the module in the next 2-3 months.
      I'm not sure yet if this will be a "Pro" module or if it will be made available for free.
      I would be grateful for suggestions and hints!
      (please have a look at the screenshots to get an idea what I'm talking about)
       




    • By apeisa
      Update 31.7.2019: AdminBar is now maintained by @teppo. Modules directory entry has been updated, as well as the "grab the code" link below.
      ***
      Latest screencast: http://www.screencas...73-ab3ba1fea30c
      Grab the code: https://github.com/teppokoivula/AdminBar
      ***
      I put this Adminbar thingy (from here: http://processwire.c...topic,50.0.html) to modules section and to it's own topic.
      I recorded quick and messy screencast (really, my first screencast ever) to show what I have made so far. You can see it from here: http://www.screencas...18-1bc0d49841b4
      When the modal goes off, I click on the "dark side". I make it so fast on screencast, so it might seem a little bit confusing. Current way is, that you can edit, go back to see the site (without saving anything), continue editing and save. After that you still have the edit window, but if you click "dark side" after saving, then the whole page will be reloaded and you see new edits live.
      I am not sure if that is best way: there are some strengths in this thinking, but it is probably better that after saving there shouldn't be a possibility to continue editing. It might confuse because then if you make edits, click on dark side -> *page refresh* -> You lose your edits.
      ***
      When I get my "starting module" from Ryan, I will turn this into real module. Now I had to make some little tweaks to ProcessPageEdit.module (to keep modal after form submits). These probably won't hurt anything:
      if($this->redirectUrl) $this->session->redirect($this->redirectUrl); if(!empty($_GET['modal'])) $this->session->redirect("./?id={$this->page->id}&modal=true"); // NEW LINE else $this->session->redirect("./?id={$this->page->id}");   and...
      if(!empty($_GET['modal'])) { $form->attr('action', './?id=' . $this->id . '&modal=true'); } else { $form->attr('action', './?id=' . $this->id); // OLD LINE }  
    • By Mike Rockett
      Jumplinks for ProcessWire
      Release: 1.5.54
      Composer: rockett/jumplinks
      Jumplinks is an enhanced version of the original ProcessRedirects by Antti Peisa.
      The Process module manages your permanent and temporary redirects (we'll call these "jumplinks" from now on, unless in reference to redirects from another module), useful for when you're migrating over to ProcessWire from another system/platform. Each jumplink supports wildcards, shortening the time needed to create them.
      Unlike similar modules for other platforms, wildcards in Jumplinks are much easier to work with, as Regular Expressions are not fully exposed. Instead, parameters wrapped in curly braces are used - these are described in the documentation.
      Under Development: 2.0, to be powered by FastRoute
      As of version 1.5.0, Jumplinks requires at least ProcessWire 2.6.1 to run.
      View on GitLab
      Download via the Modules Directory
      Read the docs
      Features
      The most prominent features include:
      Basic jumplinks (from one fixed route to another) Parameter-based wildcards with "Smart" equivalents Mapping Collections (for converting ID-based routes to their named-equivalents without the need to create multiple jumplinks) Destination Selectors (for finding and redirecting to pages containing legacy location information) Timed Activation (activate and/or deactivate jumplinks at specific times) 404-Monitor (for creating jumplinks based on 404 hits) Additionally, the following features may come in handy:
      Stale jumplink management Legacy domain support for slow migrations An importer (from CSV or ProcessRedirects) Feedback & Feature Requests
      I’d love to know what you think of this module. Please provide some feedback on the module as a whole, or even regarding smaller things that make it whole. Also, please feel free to submit feature requests and their use-cases.
      Note: Features requested so far have been added to the to-do list, and will be added to 2.0, and not the current dev/master branches.
      Open Source

      Jumplinks is an open-source project, and is free to use. In fact, Jumplinks will always be open-source, and will always remain free to use. Forever. If you would like to support the development of Jumplinks, please consider making a small donation via PayPal.
      Enjoy! :)
×
×
  • Create New...