Jump to content

renobird

PW-Moderators
  • Posts

    1,699
  • Joined

  • Last visited

  • Days Won

    14

Everything posted by renobird

  1. Double/triple checked. Images do not resize based on max width / max height of field. However, it does work to resize image after it is added to the field and the page is saved. $user_image = $user->images->first(); $newSize = new ImageSizer($user_image->filename); if ($user_image->width >= $user_image->height){ $newSize->setUpscaling(false)->resize(1200,0); }else if ($user_image->height >= $user_image->width){ $newSize->setUpscaling(false)->resize(0,1200);} This will conditionally resize the image (based on orientation) and turns upscaling off.
  2. Hi Soma, I tried that first, but images just seemed to get uploaded at the original size.
  3. OK, So I randomly stumbled across the docs on class ImageSizer() and figured I could try that — and guess what? It worked. $newSize = new ImageSizer($user->profile_photo->first()->filename); $newSize->resize(150,150); I'm not sure this is the most effective method, but it works.
  4. Do you mean, resize it in the temp location? and then attach the resized to the page? Initially I was trying via API: - add image - save - resize - save resulted in: Fatal error: Exception: Method Pageimages::size does not exist or is not callable in this context
  5. Hi Lance, I agree with much of what SiNNuT said. 1. Yeah, cool idea. 2. Ask Ryan, he may have something in the works already 3. I would submit things, if the site were built with ProcessWire and officially "sanctioned" by Ryan. 4. Personally I'd like to see it as a subdomain as well. builtwith.processwire.com or madewith.processwire.com. short of that, madewith or builtwith independent domains would be my vote. 5. Just keep it as clean and simple as possible. I like siteinspire as well, so you are on the right track.
  6. Trying this to no avail. $field = $modules->get("InputfieldImage"); $field->label = " "; $field->required = 0; $field->maxFilesize = 2*1024*1024; $field->description = "Upload Photo"; $field->attr("name+id",'profile_photo'); $field->destinationPath = $upload_path; $field->maxWidth = 100; $field->maxHeight = 100; $form->add($field); For the sake of seeing an easy result, I set it low (100). Upload happens fine. Just no resize. Also tried as: $field->maxWidth = "100"; Still no likey.
  7. Doh! I see it in the module now. Thanks Soma.
  8. Is resizing possible with InputfieldFile? I know setting max width/height in the fields settings don't effect images uploaded via API. I was hoping something like this would work: $field->maxWidth = 1000; or $field->attr("maxWidth",'1000'); but no luck. I've been looking at InputfieldFile.module to see if I could find a clue, but nope (still clueless)
  9. Maybe the default templates could be an optional part of the setup process. Perhaps an advanced options area to turn off their creation?
  10. I have to agree with Soma here. There are several working versions already. Rather than introduce yet another example, it seems like we should just wrap up the discussion with links to the already provided working examples.
  11. Welcome Andy.
  12. Glad to hear you got it working.
  13. I'd seen the original post a while ago, but at the time I was new to ProcessWire—so it didn't really sink in. I just used that method to rebuild a frontend system that allows faculty to upload and edit course syllabi. Took less than 10 minutes to get it up and running, and maybe another 20 to troubleshoot a few things unique to my needs. The API was already allowing me to run with forms, now I feel like I have a jetpack.
  14. Ryan and Soma, I would like to extend a huge thanks to both of you. You guys (along with many others) consistently take the time to not only decipher and debug code, but go well beyond that by trying to figure out what the person is "actually" trying to do and provide them with a revised/better solution—I applaud you both. Soma, your examples above are amazingly thorough — I really appreciate the time you devoted to create them, and your willingness to share. Cheers.
  15. Like I mentioned in my PM, comment out the tmp folder clean up part, and verify the file makes it to the server.
  16. Weird. That makes no sense.
  17. Just to clarify, Using the exact same code (just commenting out parts): Works: - When creating a new page that just has fields - When you just upload an image (no additional fields) Breaks: - When you combine the 2 Edit Also: - Debug mode is set to true? (/site/config.php) - no errors?
  18. Matthew, Have you checked the template's family settings? Can this pages using this template have children? Can this template be used for new pages? I would imagine if either were set to "no" that you would get an error.
  19. Matthew, Might I suggest starting as basic as possible. Basic form, with one upload and one field. Echo out everything as you go.
  20. I have a working example - doing essentially what you are after. I'll compare to yours when I get back to the office (on mobile now) and see if can spot the issue.
  21. You see this? https://gist.github.com/somatonic/4150974 Might help.
  22. $contact_photo->setDestinationPath($upload_path); I could be overlooking it (late here), but I don't see $upload_path defined anywhere.
  23. Hi Patrik, First, welcome to the forums. You can setup control like that under the access options for each template. "Add Children" is something you can choose per role. Templates > Access
  24. masterofallarts, I don't think this would accomplish what you're after, but just incase you don't already know about it... http://processwire.com/talk/topic/2458-module-fieldtypeconcatenate/
  25. antknight, Sorry for the delayed response. Your template setup looks correct. Did you manage to get it working?
×
×
  • Create New...