Jump to content

Jay D

Members
  • Posts

    12
  • Joined

  • Last visited

Everything posted by Jay D

  1. Hi all! I want to check my sanity on this one, I want to create multiple versions of an image when uploading to PW Admin, think Hero and Thumbnail. I am not finding any recent modules, so I decided to write one. Now I am having an issue where I am not able to access Image method. Does anyone have an example of how to manipulate images once it is processed? And is there a good document on how to debug the API calls? I want to avoid having the images processed every time a page is loaded, or when the cache is cleared. Thanks, Jay
  2. @gebeer Yes, I was able to fix it by adding the *1000 to this line: var startTime = parseInt($('#login_start').val())*1000; // GMT/UTC I need to make a pull request with this code, and see if they accept it.
  3. Looks like there is Login JS that is causing the issue here: /wire/modules/Process/ProcessLogin/ProcessLogin.js?v=109-1673029732 And this is the code firing the redirect: var startTime = parseInt($('#login_start').val()); // GMT/UTC var maxSeconds = 300; // max age for login form before refreshing it (300=5min) // force refresh of login form if 5 minutes go by without activity var watchTime = function() { var ts = Math.floor(new Date().getTime() / 1000); var elapsedSeconds = ts - startTime; if(elapsedSeconds > maxSeconds) { window.location.href = './?r=' + ts; } }; // reload immediately if we received browser cached login form watchTime(); watchTime(); In comparing the timestamps, the one coming from #login_start is short. Adding the "*1000" to this line fixed the redirect: var startTime = parseInt($('#login_start').val())*1000; // GMT/UTC
  4. Hi all, I am bringing up a new PW project, this is a fresh install, as well as on a new virtual machine. I was able to get all checkmarks when stepping through install process. But when logging into the admin page, it keeps refreshing and adds the following query string to the admin url: `?r=1684082315`. Any ideas on what is causing this? Debian box, Php 7.4, mod_rewrite enabled. HTTPS is not enforced.
  5. Ok, got it. There needs to be two actions to rename a image in the file system, and in the page's record: $p->of(false); $p->singleImage->add($remoteUrl); //grab the image. $p->save(); $image = $p->singleImage->first(); //load up image that was just saved. $newFilename = $parentName . '-' . $childName . '.' . strtolower($image->ext()); $p->of(false); $image->rename($newFilename); $p->singleImage->rename($image, $newFilename); $p->save(); //save changes to page. First, rename the image in the file system: $image->rename($newFilename); Then make the rename to the page/image record: $p->singleImage->rename($image, $newFilename); That works, and now my images have the names I am looking for. Thank you all for your help!
  6. Thanks all for the output formatting, makes a lot of sense, and will now include in updates to page. I actually was using it when creating the page, just not when saving again. I tested the following code and there was no difference: $p->of(false); $p->singleImage->add($remoteUrl); //grab the image. $p->save(); $image = $p->singleImage->first(); //load up image that was just saved. $newFilename = $parentName . '-' . $childName . '.' . strtolower($image->ext()); $p->of(false); $p->singleImage->rename($image, $newFilename); $p->save(); //save changes to page. File name was not changed, in either the file system or on the page's record. Then I changed the target of the renaming from the field, to the actual file, this did rename in the file system, but did not update the image field in the db: $p->of(false); $p->singleImage->add($remoteUrl); //grab the image. $p->save(); $image = $p->singleImage->first(); //load up image that was just saved. $newFilename = $parentName . '-' . $childName . '.' . strtolower($image->ext()); $p->of(false); //$p->singleImage->rename($image, $newFilename); $image->rename($newFilename); $p->save(); //save changes to page. When I use the `$p->singleImage->rename($image, $newFilename);` method it seems to expect the image object not just the file name, which is not what the docs say. Any ideas on this?
  7. I'm not sure what you mean by formatting off? How does that apply?
  8. Hi all, I am trying to pull in some data, and along with it one image. I would like to rename the image to something a little more human friendly, and seem to be running into a issue with the the actual rename part. The code below does not throw an error, but also does not rename the image file. $p->singleImage->add($remoteUrl); //grab the image. $p->save(); $image = $p->singleImage->first(); //load up image that was just saved. $newFilename = $parentName . '-' . $childName . '.' . strtolower($image->ext()); $p->singleImage->rename($image, $newFilename); $p->save(); //save changes to page. Any help on what is going wrong would be amazing! Thank you in advance, Jay
  9. Thanks for the tips Rudy! The pagination idea seems like the way to go. Do you know if there is a way to call a method by API, with no header/footer admin pages being returned? I could do some AJAX to print to screen as I loop through the data.
  10. Hi all, I am building a custom module for my project that processes some data from a separate db table into useable PW fields. I have a very basic module that extends Process. I think one of the issues is I need to start to return data to the screen, but using the return $data method, the script will wait until everything is completed to show the progress, that's where I get the 504 Gateway Timeout. Is there any way to start to output to the screen using this method? Thank you in advance, Jay
  11. Hi all, I am new to PW, and so far I am really digging it. Longtime WP and Laravel user, so PW seems very clean and efficient. One issue I am having a hard time discovering is; When I create an image array, I want to create permanent thumbnails that, are not created at time of page load. I see I have a *0x250.jpg file, but not sure where I can change the settings to make a 250x200 type image. Thank you in advance, I have been searching, and it seems most forums point to temp resizing. Jay
×
×
  • Create New...