Jump to content

Jay D

Members
  • Posts

    7
  • Joined

  • Last visited

Posts posted by Jay D

  1. 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!
     

    • Like 1
  2. 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?

  3. 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

  4. 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

  5. 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...