-
Posts
255 -
Joined
-
Last visited
-
Days Won
4
Everything posted by interrobang
-
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.
- 38 replies
-
- 19
-
-
If I can't find it on the cheatsheet, I usually directly look into the well documented sourcecode or google search the forum here.
-
Repeater pages have a method getForPage() to get the page the repeater is living on.
-
Looking for a good domain name - help me, please :)
interrobang replied to Nico Knoll's topic in Pub
nico-knolledge.de -
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!
-
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.
-
Best way to deal with multi-language images?
interrobang replied to pers0n's topic in General Support
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.- 3 replies
-
- 7
-
-
- language
- multi-language
-
(and 1 more)
Tagged with:
-
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.
-
Showing field name on label hover not working
interrobang replied to Soma's topic in General Support
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 -
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.
- 32 replies
-
- manipulation
- imagesizer
-
(and 3 more)
Tagged with:
-
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;";
-
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/
-
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/
-
Hi Horst, sorry, I did not mention these are new features from the dev branch. Ryan added them some months ago: http://processwire.com/talk/topic/3145-multiple-views-for-templates/?p=32876 github commit
-
Thanks for the answer, but all my templatefiles are in "site/templates/" This way it works without having a "basic-page.php" file: include("./head.inc"); $p = $pages->get('/about'); $p->template->filename = $config->paths->templates . "basic-page-alt.php"; echo $p->render(); include("./foot.inc"); Shouldn't this be exactly the same as echo $pages->get('/about')->render("basic-page-alt.php") ?
-
I have a setup with several templates without a templatefile. But I want to render some of the pages using these templates with $page->render($filename). I think I did not understand how the $page->render options work. A simple example: In the default profile I just delete the "basic-page.php" file and create a new file "basic-page-alt.php" with this simple code <?php // basic-page-alt.php echo "<h1>$page->template</h1>"; and I modify the home.php file to<?php // home.php include("./head.inc"); echo $pages->get('/about')->render("basic-page-alt.php"); include("./foot.inc"); When I try to view the homepage I get an errorError: Exception: Template file does not exist: '/XXX/Sites/pw_test/site/templates/basic-page.php' (in /Users/XXX/pw_test/wire/core/TemplateFile.php line 67) When I put a empty "basic-page.php" back in my templates folder I get the expected result. I am using the latest dev from github. Is this the intended behaviour?
-
I need to output the prev/next links on all pages, even on the first/last page, but with an additional class "disabled". Whats the best way to get an output like this? Any idea how to change my output with a hook? Or should i just copy/rename the module and modify it to my needs?
-
.htaccess Causing a 403 Forbidden Error in Sub/Add-On Domains
interrobang replied to 4ldesigns's topic in Getting Started
If you can change the document_root for each of your domains the should be no need to redirect. None of your domains should have the public_html folder as a document_root. Maybe this cpanel forum thread helps in setting up the document roots: http://forums.cpanel.net/f34/how-change-primary-domain-landing-folder-227531.html- 11 replies
-
- 1
-
-
.htaccess Causing a 403 Forbidden Error in Sub/Add-On Domains
interrobang replied to 4ldesigns's topic in Getting Started
If I understand the problem correcty, the easiest solution is to organize your folder a little bit different. I would suggest that you keep each site in its own subfolder, so your public_html folder contains only some folders, but no .htaccess or similar. This way you avoid that your public_html/.htaccess rules are inherited by your other domains/sites. Use these subfolder as your document root in cPanel. public_html/example.com/ public_html/secondwebsite.com/- 11 replies
-
- 1
-
-
How to set page name in different languages through the api?
interrobang replied to lpa's topic in Multi-Language Support
Any news on this? I just ran into the same issue. When bootstrapped I cloud not set/save a new pagename for non-default languges. The same code in a template file works without problems. I am running the latest dev. include("./index.php"); foreach (wire('pages')->get('/projects')->children as $p) { $p->of(false); foreach (wire('languages') as $lang) { $title_translated = $p->title->getLanguageValue($lang); if ($lang->isDefault() || !$title_translated) { continue; } $pagename_field = "name$lang"; $pagename_translated = wire('sanitizer')->pageName($title_translated, Sanitizer::translate); // only set new translated pagename when empty if (strlen($p->get($pagename_field)) > 0) { continue; } $p->set("status$lang", 1); $p->set($pagename_field, $pagename_translated); $p->save(); } } -
I think you can enable Cross-domain AJAX requests in your .htaccess # ------------------------------------------------------------------------------ # | Cross-domain AJAX requests | # ------------------------------------------------------------------------------ # Enable cross-origin AJAX requests. # http://code.google.com/p/html5security/wiki/CrossOriginRequestSecurity # http://enable-cors.org/ <IfModule mod_headers.c> Header set Access-Control-Allow-Origin "*" </IfModule> found in html5-boilerplates .htaccess
-
When you click on one of your languages in the site tree you don't get the usual "edit", "new", "move" menu? I am talking about moving the language pages in the site tree an the left side of the screen, not in the languages setup page you see when you go through the setup link in the top navigation. Btw, welcome to the forum!
-
You can sort the languages in the site tree (Admin/Setup/languages)
-
New ProcessWire admin theme on dev branch
interrobang replied to ryan's topic in Themes and Profiles
Sorry, I was only talking about Kendo UI Web, which is is dual-licensed, Commercial and Open Source (GPLv3). I think the GPLv3 version could be used on the frontend too. No? -
New ProcessWire admin theme on dev branch
interrobang replied to ryan's topic in Themes and Profiles
I have KendoUI in my bookmarks for some time, but never used it, so I don't want to recommend it. But it looks like it can do everything jQueryUI can do, plus some more. And at least the colors are themeable with sass. Here is a site comparing both: http://jqueryuivskendoui.com/