Jump to content

Shehbaz

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by Shehbaz

  1. Hi, I am facing a strange issue which appears randomly on the server. I have this code in one of my module which un publishes on page and publishes the other after swapping their titles and changing names: $draft->setOutputFormatting(false); $draft->publish_from=''; $draft->save(); $parent = $draft->parent; $parent->setOutputFormatting(false); $name = $parent->name; $title = $parent->title; $parent->title =$parent->title. '(DRAFT)-' . ' unpublished at: '.date("Y-m-d H:i:s"); $parent->name = $draft->id."_".$parent->name. "-" . uniqid(); $parent->addStatus(Page::statusUnpublished); $parent->save();// The issue appears on this line I get issue randomly on last line: Can't save page 3619: /xxxxx/repeaters/for-field-199/for-page-3617/1401436320-9546-1/: Call $page->setOutputFormatting(false) before getting/setting values that will be modified and saved. [image] Now this is not the actual page (parent), it is a repeater field inside that page. Stacktrace: #0 [internal function]: Pages->___save(Object(RepeaterPage), Array) #1 call_user_func_array(Array, Array) #2 Wire->runHooks('save', Array) #3 xxxxx/Fieldtype/FieldtypeRepeater/FieldtypeRepeater.module(961): Wire->__call('save', Array) #4 xxxxx/Fieldtype/FieldtypeRepeater/FieldtypeRepeater.module(961): Pages->save(Object(RepeaterPage), Array) #5 [internal function]: FieldtypeRepeater->___savePageField(Object(Page), Object(Field)) #6 xxxx/wire/core/Wire.php(271): call_user_func_array(Array, Array) #7 xxxx/wire/core/Wire.php(229): Wire->runHooks('savePageField', Array) #8 xxxx/wire/core/Pages.php(576): Wire->__call('savePageField', Array) #9 xxxx/www/wire/core/Pages.php(576): FieldtypeRepeater->savePageField(Object(Page), Object(Field)) #10 [internal function]: Pages->___save(Object(Page)) #11 xxxx/wire/core/Wire.php(271): call_user_func_array(Array, Array) #12 xxxx/wire/core/Wire.php(229): Wire->runHooks('save', Array) #13 xxxx/wire/core/Page.php(1005): Wire->__call('save', Array) #14 xxxx/wire/core/Page.php(1005): Pages->save(Object(Page)) #15 xxxx/site/modules/SchedulePages.module(222): Page->save() #16 xxxx/wire/core/Wire.php(293): SchedulePages->RunSchedulePages(Object(HookEvent)) #17 xxxx/wire/core/Wire.php(229): Wire->runHooks('everyMinute', Array) #18 xxxx/wire/modules/LazyCron.module(164): Wire->__call('everyMinute', Array) #19 xxxx/wire/modules/LazyCron.module(164): LazyCron->everyMinute(69) #20 xxxx/wire/core/Wire.php(293): LazyCron->afterPageView(Object(HookEvent)) #21 xxxx/wire/core/Wire.php(229): Wire->runHooks('finished', Array) #22 xxxx/index.php(193): Wire->__call('finished', Array) Any help is appreciated. Thanks
  2. The solution was to change code so it writes the image to tmp or any other folder and then copy it to s3 mounted folder.
  3. Hi, I am facing a strange issue, I needed to return images associated with the pages so I implemented the following hook, but strangely this puts the system in infinite loop. $this->addHookAfter("FieldtypePage::wakeupValue", $this, "hookWakeupValue"); To check further I removed the hook, opened the fieldtypepage.module file and in ___wakupValue function put this before return, i.e. returning $images array instead of pageArray $images = new WireArray(); foreach ($pageArray as $pg) { $images->add($pg->get("asset_image")); } return $images; This again puts the system in infinite loop, I am clueless on whats happening. The loop is working fine as I have tried returning the pageArray after loop and it works fine. $images = new WireArray(); foreach ($pageArray as $pg) { $images->add($pg->get("asset_image")); } return $pageArray; Is there anything I am missing or not aware of? Any help is really appreciated. Thanks
  4. I really feel stupid to ask this, I hope I could have deleted this post. Its simple doing page->parent = new_parent
  5. Hi, I have a situation where I want to make new parent of child page and trash the existing parent. I supposes simply changing parent_id does not work as I tried it and it makes system unstable. is there an easy way to achieve this? P.S. I understand cloning with parent might be a solution but it has its dropbacks for my situation and can not use it plus it bombs out on my production for nested calls and I can not do anything about config on server. Thanks
  6. Looks like it is an issue with the mounted drive for s3. So images are not written on it. Any idea how to solve this?
  7. Hi, I am trying to create multiple versions of the uploaded image. Everything goes smooth on my local development machines (multiple) but image generation does not work on server. It gives message that image contains error. Here is the original image: beta-fh-east.fisherhouse.org/site/assets/files/2662/alyssa-milano-high-quality.jpg Code that converts it is as follow: $image->size(350,0); $image->size(480,0); $image->size(560,0); $image->size(680,0); $image->size(760,0); $image->size(840,0); $image->size(960,0); $image->size(1200,0); Server Files: -rw-r--r-- 1 www-data www-data 267278 May 8 10:45 alyssa-milano-high-quality.1200x0.jpg -rw-r--r-- 1 www-data www-data 27619 May 8 10:45 alyssa-milano-high-quality.350x0.jpg -rw-r--r-- 1 www-data www-data 49102 May 8 10:45 alyssa-milano-high-quality.480x0.jpg -rw-r--r-- 1 www-data www-data 64335 May 8 10:45 alyssa-milano-high-quality.560x0.jpg -rw-r--r-- 1 www-data www-data 91962 May 8 10:45 alyssa-milano-high-quality.680x0.jpg -rw-r--r-- 1 www-data www-data 113649 May 8 10:45 alyssa-milano-high-quality.760x0.jpg -rw-r--r-- 1 www-data www-data 137203 May 8 10:45 alyssa-milano-high-quality.840x0.jpg -rw-r--r-- 1 www-data www-data 186581 May 8 10:45 alyssa-milano-high-quality.960x0.jpg -rw-r--r-- 1 www-data www-data 461206 May 8 10:45 alyssa-milano-high-quality.jpg File sizes appears to be appropriate according to the dimensions. Any sort of help is appreciated. Thanks
  8. Thanks @apeisa and @Martijn I have sent a pull request, thumbnail,0,100 or thumbnail,100,0 should work now. Thanks
  9. Hi, First I will like to say my thanks for the module as I am using it in my solution. I needed to crop images based on their width only in some cases, I read the thread and there was a discussion of implementing it, not sure what was the conclusion but looking at code shows me that it is not implemented. As I understand that ImageSizer's resize function can work without providing a height (or providing 0) and in this case it only considers width. Isn't it logical we remove the height condition from condition as follow, ($this->w < 1) { throw new WireException(sprintf($this->_("Width not found for thumb: %s"), $thumb)); return; } and if height is 0, then $sizer->resize($this->w, $this->h) will just work fine based on width. I have tested and it works fine but before I deploy it on production I need an opinion? Thanks
×
×
  • Create New...