Jump to content

Soma

Moderators
  • Posts

    6,808
  • Joined

  • Last visited

  • Days Won

    159

Everything posted by Soma

  1. Awesome thanks avoine!
  2. Add novalidate to the form attributes and theyr gone.
  3. RT @jalajoki: I've used #processwire #cms for two hours now and already writing my first module :)#webdev

  4. post_max_size and upload_max_size isn't an option as it wouldn't allow for multiple files and also upload would fail silently. But there's a maxFileSize on file fields, it's not I'm not sure why it's not in the field settings. ... else if($this->maxFileSize > 0 && $size > $this->maxFileSize) { ... I guess it can be set via a hook and you could try setting it to a reasonable size. Sorry, actually it's in teh WireUpload class and not the file field. But anyway it's there for a reason. And it's also maxFilesize in the file inputfield, but it checks for the php post_max_size to get the max size, and this is for all files in a multiple file field.
  5. There's no variations for files (non images) or is it? I don't think you can resize pdf's.
  6. RT @hansdesmedt: @processwire you amazed me! As a #cms so simple yet so powerful. #robot

  7. So there's a ton of functions and filter but auto-levels http://www.imagemagick.org/script/command-line-options.php#auto-level there's nothing in GD? ...
  8. It's the same, as image field is just extending file fieldtype.
  9. There is no way to allow html in there so you can't enable it. Markdown links are supported as martjin wrote previous post.
  10. As Ryan already said use direct sql then.
  11. Is there a auto level or auto adjust function in gd like with imagemagick?
  12. Have you added http://?
  13. $templates = $event->return; ... since the method returns the templates
  14. Yeah I like it better.
  15. I looked closer and it doesn't work as simple, you have to call trackChange on image field for basename and remove variations too. So this will work: $old_name = 'wizard.jpg'; $new_name = 'lizard'; $p = $pages->get("image.data=$old_name"); $p->of(false); // outputformatting off, single and multiple image fields are from now on wire array's // get the image and the extension $image = $p->image->find("name=$old_name")->first(); $ext = $image->ext; $newFilename = $new_name . "." . $ext; $p->image->trackChange("basename"); $image->removeVariations(); $image->rename($newFilename); $p->save("image");
  16. Ahhh Mr. ImageHorstManipulation No it doesn't work I'm afraid to say. Also the image variations doesn't get deleted and the image will not be changed in DB.
  17. To delete pages you may use delete. http://cheatsheet.processwire.com/?filter=delete (must have been still in m clipboard ) $pages->delete($page, true); // recursive with children $pages->delete($page); $page->delete(); To get pages from the trash you would need include all $pa = $pages->find("parent=/trash/,include=all"); $pages->get() will give you only 1 page. http://cheatsheet.processwire.com/?filter=pages-%3Eget
  18. Or a bit of API vodoo. $old_name = 'lizard.jpg'; $new_name = 'wizard'; $p = $pages->find("image.data=$old_name")->first; $p->of(false); // outputformatting off, single and multiple image fields are from now on wire array's $path = $p->image->path; $page_image = $p->image->first(); $ext = $page_image->ext; $orig_image = $page_image->filename $new_image = $path . $new_name . "." . $ext; echo "orig: " . $orig_image . "<br/>"; echo "path: " . $path . "<br/>"; echo "ext: " . $ext . "<br/>"; echo "new: " . $new_image . "<br/>"; // copy and rename copy($orig_image, $new_image); // remove old, add new image to page $p->image->remove($page_image); // orig, will get deleted $p->image->add($new_image); // new $p->save(); Or in a shorter code: https://gist.github.com/somatonic/6282944
  19. Soma

    parentmost

    If that's right it would the the first child or the first child that has children? Not sure. But he's speaking of a "parent"? So this would be easy with $page->child("template=xy, children.count>0"); To get the first child of a page: $page->child() will give you the first child with regarding to the sorting. $page->child("template=sowieso") same as $page->children("template=xy")->first();
  20. Soma

    parentmost

    $page->parents("template=thing"); $page->parent("template=thing"); Look cheat sheet for reference. But then I don't understand at all what exactly you looking for.
  21. This is kinda fun... Q: How could I easily replace the original pageimage keeping same filename?
  22. It doesn't do anything. Ok strange, now it works, and I only added some echo "test" inside the getPageImageManipulator() and uploaded. So I think I got when testing added a exit() there and haven't uploaded the module when removing it. Darn. Thanks for your time.
  23. You can't just rename them physically and then think PW magically still knows which file it is. This is because PW saves the name of the file to the db. It's like the key! So you'd also have to rename it in the DB table field_yourfieldname also and you'll see.
  24. Ditto, I have created some routine in a module to create fields and templates via API which would have taken maybe 400 lines of code to 100. https://gist.github.com/somatonic/6272112 To delete the fields and template from this it's also easy. I know there will be soon something based on array or json/yaml to create fields and export/import those things more easy. But just maybe find it useful.
  25. Edit: just updated the module to 1.2.0 to commit addition I've done regarding the hook I've used in the original example. Now the MarkupSimpleNavigation::getItemString() exists if you update to the latest version and can be used instead of getTagsString(). I know it sound strange but I didn't like the function name for the hook and didn't want to break backward compatibility that's why I added an additional function that suits better.
×
×
  • Create New...