Jump to content

Not enough memory to load/resize


matjazp
 Share

Recommended Posts

no problem, your suggestion to do it by a new inputfield-file variant works perfect, i have a multiple-file field now, that executes the imagick scaling after upload und shows the generated thumbnail in the file-list. pretty good for the first step, as i think.

  • Like 1
Link to comment
Share on other sites

Sure.

$page->imageField->add($path);

Thank you kobrakai,

i`ve problems to get the $page varible in my inputfield module. i'm not really familiar with modules in general, so maybe i don`t understand someting common here.

Link to comment
Share on other sites

no. i've cloned the inputfield-file module to InputfieldFileApp.module (and copied FieldtypeFile.module as FieldtypeFileApp.module inside the folder). The new filefield works, i can use some custom functions inside, this is good. But now, i want to copy a specific version of a new uploaded file to another field, an image field on the same template.

inside InputfieldFileApp.module wire('page') is the edit page, not the page the field is on. thats logical, but doesn't help me out.

Link to comment
Share on other sites

It would be more "update-prove" to just hook the existing modules and add in your needed function on runtime, but this works, too. Most inputfields work independent on any page context, like the file field. Therefore the Fieldtype does add some hooks to dynamically inject this information, to cater for changing uploadPaths (see setupHook). You could edit the called function to not only inject the path, but also the $page object into the inputfield. 

Link to comment
Share on other sites

ok, thank, that helped, declaring $inputfield->editPage = $page; in the Fieldtypes hookProcessInput function i have the page-object in the inputfield module.

inside the ProcessInput function i create my image variants and with

$this->editPage->app_img->add($this->destinationPath.$filename."-app-web.jpg");
$this->editPage->save();

... i can copy the image to the app_img field in the background and it appears when saving the page. Is it possible to actualize the image-field after the add() is done?

Link to comment
Share on other sites

That's not easily possible as the server cannot tell the client that there's a new image without the client actually requesting data from the server. You'd need to change the javascript of the image field to do some kind of server polling and requesting new images.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...