Jump to content

interrobang

Members
  • Posts

    238
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by interrobang

  1. As this became a cmscriticcritics thread I have another suggestion: Test and optimize your mediaqueries. See attached screenshot.
  2. Thanks for giving my module a try. I see that it would be handy in your case, but I think it's better to keep these Textformatters separate. Not everybody wants obfuscation, and having separate Formatters is way more flexible.
  3. I pushed some updates to github: Toggling Grid Mode works now In Grid mode you see only a icon on the thumb to edit the focusArea You no longer have to set a suffix by yourself, this is automatically done in the module Updated version to 0.4.0
  4. Thanks Horst, but forceNew won't help if you are testing all the different cropping options at once, because at least some of the image variant urls would be the same. Thanks for the suggestion to add the suffix internally in my module. I will push a update to github later today. I was not sure if this should be up to the developer or not. If I see it right, currently PageImage::size adjusts filename for cropping settings, all other options are not reflected in the filename.
  5. I pushed some updates to github. Outside cropping works now if $image->size() is called with height=0 or width=0. See my first post for updated API examples to get images with the same ratio as the focusarea Another thing I think I should mention: If you are testing the different cropping options make sure you prevent getting cached versions. In the moment you have to set the 'suffix' option by yourself. Maybe the module should to this automatically? (Edit: Since version 0.4.0 the suffix option is set internally by the module, I remove the suffix setting from the example code) btw, I do my testing like this: <?php $image = $page->focusimages->eq(0); $image->removeVariations(); $sizes = array( array(400, 400), array(400, 300), array(400, 200), array(400, 100), array(300, 100), array(200, 100), array(100, 100), array(100, 200), array(100, 300), array(100, 400), ); $croppings = array( // 'center', 'align', 'inside', 'outside' ); $upscaling = true; ?> <?php foreach ($croppings as $cropping): ?> <div class="row"> <h1>cropping: <?= $cropping ?></h1> <?php foreach ($sizes as $size): ?> <?php $img = $image->size($size[0], $size[1], array('cropping' => $cropping, 'upscaling'=>$upscaling)); ?> <div class="cropping-example"> <span class="info">Size: <?= $size[0] ?>×<?= $size[1] ?></span> <img src="<?= $img->url ?>" width="<?= $img->width ?>" height="<?= $img->height ?>"/> </div> <?php endforeach ?> </div> <?php endforeach ?>
  6. Or you can use wireRenderFile a new addition to ProcessWires functions: https://processwire.com/blog/posts/processwire-2.5.2/#new-wirerenderfile-and-wireincludefile-functions echo wireRenderFile('markup/contact-markup.php', array( 'name'=>'john doe', 'address'=>'sample street', 'zip'=>'sample city' )); I did not test this example, but according to the docs it should work like this. Requires ProcessWire 2.5.2
  7. TextformatterMakeLinks This Textformatter module is just a wrapper around the method fHTML::makeLinks from flourishlib (http://flourishlib.com/api/fHTML#makeLinks) The following description is basically just slightly modified copy from the official flourishlib documetation (http://flourishlib.com/docs/fHTML): The Textformatter will parse through a string and create HTML links out of anything that resembles a URL or email address, as long as it is not already part of an tag. Here is an example of it in action: If you put this text into a textarea inputfield which uses this textformatter Example 1: www.example.com. Example 2: https://example.com.'>https://example.com. Example 3: john@example.com. Example 4: ftp://john:password@example.com.'>ftp://john:password@example.com. Example 5: www.example.co.uk. Example 6: john@example.co.uk. Example 7: <a href="http://example.com">http://example.com</a>. The output would be: Example 1: <a href="http://www.example.com">www.example.com</a>. Example 2: <a href="https://example.com">https://example.com</a>. Example 3: <a href="mailto:john@example.com">john@example.com</a>. Example 4: <a href="ftp://john:password@example.com">ftp://john:password@example.com</a>. Example 5: <a href="http://www.example.co.uk">www.example.co.uk</a>. Example 6: <a href="mailto:john@example.co.uk">john@example.co.uk</a>. Example 7: <a href="http://example.com">http://example.com</a>. Downloadhttps://github.com/phlppschrr/TextformatterMakeLinks http://modules.processwire.com/modules/textformatter-make-links/
  8. I just pushed some updates to github. I optimized the handling of the 'outside' mode. Before the update I switched the 'outside' mode to 'align' if the focusArea was smaller then the target size, now I try to expand the focusArea on each side. @BernhardB: Please give the latest version a try, maybe if fixes your issues, too. I could not reproduce the behaviour you described until now. And update your PW to the latest dev, Ryan just merged Horsts fixes to the ImageSizer.
  9. @BernhardB: Thanks for testing, but I am not sure whats happening there. Do you use 'upscaling'=>false? There is a know bug when upscaling is disabled in the current PW release. Horst already fixed it in his fork, and the fix should be included in the next dev release. See 2nd post of this thread. If you don't prohibit upscaling I will try to reproduce whats happening here.
  10. Thanks for the bug report Bernhard. The updated and renamed module is now on github.
  11. I just added a new (experimental) property 'cssBackgroundSize' to Pageimage for supporting frontend responsive images without javascript. Should be used together with background-position: cover. In my tests this worked amazingly well. The result is similar to the 'align' mode. <style> .cssimg{ background-size: cover; } </style> <div class="cssimg" style="background-position: <?= $image->cssBackgroundPosition ?>; background-image: url(<?= $image->url ?>); width:200px; height: 200px; "></div>
  12. @horst: Thanks for the info and fix. I just tested your fixed ImageSizer, and now everything looks like expected! @all: Which module name do you prefer for field? Before putting this to the module directory I will likely rename this module. ImageFocusrect ImageFocusArea ImageCroppingArea ImageSoftCrop FocusImage anything else? -- Edit: Thanks for your feedback. I renamed the module to ImageFocusArea
  13. Inputfield And Fieldtype ImageFocusArea requires ProcessWire 2.5.6 or later This Inputfield makes it possible to select the important part of the image and use this area for different cropping options. This module is not a replacement for the existing Thumbnails module, though depending on your need it probably could replace it in many cases. I think a more flexible cropping approach than the existing Thumbnails module is useful especially when using the new html <picture> and you don't want the editor to define multiple thumbnails. Usage Create a new Inputfield ImageFocusArea and add it to the desired template. Edit a page with this template and add an image to the new field. You will see a link "Add Image Focusarea". Click the link and you will see a popup with a cropping tool similar to the Thumbnails module. Select the important part of the image, click "apply" and save the page. By default the Field hooks into Pageimage::size and automatically populates the cropping option with percentages of the center of the selected focusarea. You can always override this behaviour by calling $image->size with a different cropping option (e.g. $image->size(100,100,array('cropping'=>'center'))). The module introduces 3 new cropping options: align: This is the default if you do not override it with another cropping option. When resizing a image the module only adjusts the alignment of the crop. You will get the most zoomed-out result of these options. inside: Only parts inside of the selected area are used in the resulting image. You will get the most zoomed-in result of these options. outside: The resized image will contain the whole selected area. The surrounding imagearea will be used to reach the targetsize. This is also true for upscaling=false. Upscaling will only happen if the source image was smaller then the targetsize. API usage examples // here we force the old/usual 'center' mode: echo "<img src='{$page->image->size(200,200,array('cropping'=>'center'))}' />"; // by default if you did not define a cropping option, the cropping option gets automatically populated // Both calls will result in the same image: echo "<img src='{$page->image->size(200,200)}' />"; echo "<img src='{$page->image->size(200,200, array('cropping'=>'align'))}' />"; // the resulting image will be the center area of the selected focusarea echo "<img src='{$page->image->size(200,200, array('cropping'=>'inside'))}' />"; // to get an image with exactly the same ratio as the focusarea use width()/height() instead of a size() echo "<img src='{$page->image->width(200, array('cropping'=>'inside'))}' />"; echo "<img src='{$page->image->height(200, array('cropping'=>'inside'))}' />"; // the whole selected area will be part of the image, the surrounding imagearea will only be used to reach the targetsize echo "<img src='{$page->image->size(200,200, array('cropping'=>'outside'))}' />"; Flexible CSS Background Images Additionally you can access a new property cssBackgroundPosition, which could be useful for frontend responsive images. The visual result is similar to the cropping='align' mode, but depending on the size and postion of the focusArea and your images source and target size your mileage may vary. This property is intended to be used together with background-size: cover;. It is important that the background-image has the same ratio as the original image! <style> .cssimg{ background-size: cover; width:200px; height: 200px; } </style> <div class="cssimg" style="background-position: <?= $image->cssBackgroundPosition ?>; background-image: url(<?= $image->url ?>); "></div> Downloadhttps://github.com/phlppschrr/ImageFocusArea remember, this modules requires ProcessWire 2.5.6 or later There are still known bugs with upscaling=false, but I am not sure if it is a bug of this module or a ProcessWire bug. (fixed in ProcessWire 2.5.6) Thanks to Ryan and especially Horst for all the new great API additions for Pageimage und ImageSizer which made this module possible. This is my first module. If you notice any problems or unexpected behaviour post here or fill an issue on github. I am open to all suggestions. Do you think the cropping option names (align, inside, outside) are descriptive enough? Any better ideas? -- Edit: Renamed the Module to ImageFocusArea and updated the github link Edit 2: Reformatted this post and added some additional information.
  14. If I can't find it on the cheatsheet, I usually directly look into the well documented sourcecode or google search the forum here.
  15. Repeater pages have a method getForPage() to get the page the repeater is living on.
  16. Marcus and me are trying to meet tomorrow evening at the BT WarmUp Event. If anyone else wants to join us, send me a message here and we will try to find you. Or you can walk around there and show your smartphone with the ProcessWire website or something like this. I hope I meet some of you tomorrow!
  17. Does anybody here visit the Beyond Tellerrand conference next week? I will arrive in Düsseldorf at sunday evening together with a coworker. Could be a good occasion for a mini ProcessWire Meetup.
  18. ProcessWire has language alternate fields, which basically do what you describe out of the box. Unlike multi-language fields, language alternate fields can also be used with image fields.
  19. Congratulation for your new store, Ryan! I hope to see more of your ProModules. Still waiting for your ProFields module But, did you change the pricing for the ProCache module? The old di.net store has far lower prices than the new store for pro, dev and agency editions.
  20. Tested it on a multilanguage site I am currently working on (2.4.1 dev), and it is working on all fields on my templates except a checkbox field. I also always install your HelperFieldLinks module, and would be happy if a functionality like this would be include in the core. I never use the current implementation because it does not help me in my usecases. edit: Tested it on the Edit Template pages, and noticed that the arrow of these fields does not reveal the field name: - Sort settings for children - Allow page numbers - Allow url segments
  21. I have a problem with autorotation and resizing. I have a jpg, which is rotated. When i call $img->size(200,100) for the rotated image the result of is width=100, height=200. As a workaround I currently chain 2 size call to get the correct result ($img->size(10000,10000,array('upscaling' => false, 'cropping' => false))->size(200,100)). I am using the latest dev from PW (2.4.1). Is there something special with this jpeg? I don't have other rotated images here, so I can't test myself.
  22. Today I had to deploy a site to a server which uses a socket for connecting to mysql. It seems socket support is not handled in WireDatabasePDO. Inserting 2 lines in the WireDatabasePDO::getInstance method fixed it: $host = $config->dbHost; $username = $config->dbUser; $password = $config->dbPass; $name = $config->dbName; $port = $config->dbPort; // get socket from $config: $socket = $config->dbSocket; $dsn = "mysql:dbname=$name;host=$host"; if($port) $dsn .= ";port=$port"; // if socket is provided ignore $host and $port and use $socket instead: if ($socket) $dsn = "mysql:unix_socket=$socket;dbname=$name;";
  23. I think vxda is asking about the built-in gettext-like translatable strings in template files: http://processwire.com/api/multi-language-support/code-i18n/
  24. slice is a method of WireArray and multifile fields are WireArrays too. see here for available methods: http://processwire.com/api/arrays/ or http://cheatsheet.processwire.com/
×
×
  • Create New...