Leaderboard
Popular Content
Showing content with the highest reputation on 12/22/2014 in all areas
-
Hey, I added a pull request on GitHub https://github.com/NicoKnoll/FirstSteps. I think we should work together on this module4 points
-
3 points
-
(You just have to merge. It works great so far and I even updated intro.js and added a processbar and more). At the moment I'm adding all of my GetStarted texts to it (I have holidays so I have some time at the moment )3 points
-
3 points
-
Pia - Pageimage Assistant Hello, today I can tell you that Pia Ballerina want to assist you with Pageimages and that can become really helpful! . . . Pia, in its current state, version 1.0.0, provides: a GUI (the module config screen) for quick and easy changes to the sitewide Pageimage default options an alternative way for calling the Pageimage resizing methods with PW selector strings three new methods as shortcuts to the resizing functions a new method called retinafy and its alias hiDPI, (introduced in version 0.2.0) . . . 2) Instead of ->width(), ->height(), ->size() you can call ->pia() now. With a PW selector string you tell Pia what image variation you want to have : . $image->pia("width=100, quality=80, sharpening=medium")->url; . If you want process ->width() just define width. If you want process ->height() only define height. If you want process ->size() just define width and height. If you want process ->size() with equal values for width and height, just define only size, or use the alias square: . $image->pia("width=480")->url; $image->pia("height=320")->url; $image->pia("width=400, height=300")->url; $image->pia("size=350")->url; $image->pia("square=350")->url; . So, yes, - I see. Now you may think: "Ok, nice looking girl, - and she can dance very well, - but for what should it be good that she is involved here? My very old buddies width, height and size - and me, - we don't need any Ballerinas between us!" . Yeah, I see what you mean. But this above is not what Pia is good for, this is just a little warming up for you. . In some cases one need to specify more than just width and / or height. If it comes to that you need explicitly populated options with the individual pageimages, Pia will become faster and more comfortable at some point. Also the code is looking more readable with Pia, at least to me: . // regular style #1: $image->width(800, array("upscaling" => false, "cropping" => true, "quality" => 80, "sharpening" => "strong")); // or regular style #2: $options = array("upscaling" => false, "cropping" => true, "quality" => 80, "sharpening" => "strong"); $image->width(800, $options); // now lets Pia dance: $image->pia('width=800, upscaling=0, cropping=1, quality=80, sharpening=strong'); $image->pia('width=800, upscaling=off, cropping=on, quality=80, sharpening=strong'); . For me it is that not only Pia begin to dance, my fingers do so too when writing selector strings instead of the regular array code. . Ok, last thing before we can go to stage: "You already may have noticed that Pia accepts few different values for boolean expression, yes?" for TRUE you can write these strings: "1, on, ON, true, TRUE, -1" for FALSE you may use one out of "0, off, OFF, false, FALSE" Ready? Ok, lets go to stage. . . . 3) Pia provide three new methods as shortcuts. This means that when using one of the shortcuts you have pre-populated options, regardless of the sitewide default settings: crop :: does what the name says contain :: is equal to the regular method: ->size($width, $height, array("cropping" => false)) cover :: this, Pias third child, is a new kid on the block . Let's have a closer look and compare it. We use Pias image from above as source for this example. (It's dimensions are 289 x 400 px) . . * crop $image->crop('square=100'); . it is 100 x 100 px and the name is: pia-ballerina_titel.100x100-piacrop.jpg . . . * contain $image->contain('square=100'); . it is 73 x 100 px and the name is: pia-ballerina_titel.100x100-piacontain.jpg . . . * cover $image->cover('square=100'); . it is 100 x 139 px and the name is: pia-ballerina_titel.100x139-piacover.jpg . . . Ok, you got it? . "Crop" crop out the area, "Contain" fits the image into the area, and "Cover" calculates the needed dimensions for the image so that the area is completly covered by it. . Following is a link with lots of those crop-, contain-, cover- variations. I have stress-tested it a bit: much variations . ---------- . . Later Additions: . * contain with option weighten Since version 0.0.6 contain can take an additional param called "weighten". (read more here) . . . * retinafy Since version 0.2.0 retinafy is added. It returns a markup string, e.g. a HTML img tag, where placeholders are populated with property values from the pageimage. Default properties are: URL, WIDTH, HEIGHT, DESCRIPTION. The method also can take an optional array with CustomPropertyNames. You also can use the alias HiDPI if you like. (read more here) . . ---------- . . You can get the module from the modules directory or from the repo on Github: . git clone https://github.com/horst-n/PageimageAssistant.git your/path/site/modules/PageimageAssistant . . Bye! . Classical ballet performance at the Aalto Theatre in Essen, in the context of the Red Dot Award ceremony 26 June 2007, Act III, Sleeping Beauty, the wedding reception Photos: Horst Nogajski - www.nogajski.de2 points
-
Alternate language fields work just fine for files and images.2 points
-
2 points
-
GitHub: https://github.com/adrianbj/ProcessMigrator This module has gone through lots of iterations with lots of new functionality each time. It is now a fully fledged content migration tool. *** Please be sure to read the GitHub ReadMe to find out what it can do now as most of the posts in this thread are no longer correct regarding its functionality Once it is release worthy, I'll create a fresh thread with all the details. This modules allows export, sharing, and import of page lists via JSON files. It takes care of replicating all the pages, as well as creating any templates and fields that are needed. I have defined "Page Lists" as page trees (parent and children) that store selector values for a Page fieldtype. An example would be a list of countries that would be used to populate a countries drop-down select field. The fields might include: Country Name, 2-digit code, 3-digit code, number code. I would like to suggest a place where we can post json files to be shared and updated - maybe a dedicated github repository? Start of a repo of lists ready to import is now available: https://github.com/adrianbj/ProcessWirePageLists It might handle migrating other simple pages trees as well, but it should not be considered a tool for migrating general pages as it does not handle associated files, nor does it handle fields which store arrays. Probably lots of other things it doesn't handle either It now handles migrating all (I think) field types, including repeater fields, page fields, all Profields fields, multi-language versions of fields etc. The only omission is the actual uploaded files and images in file/image fields. WARNING: This should be considered an Alpha module - please don't use this on a live site at the moment and be sure to back everything up before testing. Would appreciate any feedback on the concept, the code, and the idea of a shared and community edited resource of these files. Also, would love to hear what page lists would be good to share. Here are a few quick ideas: States (separate files for each country) Measurement units Languages Religions Race Academic subjects (chemistry, biology etc) Publication types (book, journal article, newspaper article, newsletter, thesis etc) Car makes and models Anyone have a better idea for a name, or how to better describe "Page Lists"?1 point
-
Thanks for giving those insights. I have made a note to the additional param for wider aspect ratios, what wouldn't be much work to implement, but will wait if other users request support for weighten with those wider aspect ratios. Thanks for your help with this.1 point
-
Hey @Ledzepman, here is a good reading about how to deal with urlSegments: https://processwire.com/docs/tutorials/how-to-use-url-segments/ And if you not already know it, best search results do you get with google like this: // searches the whole PW site https://www.google.com/search?q=site:processwire.com+urlsegment // only search in forum posts https://www.google.com/search?q=site:processwire.com/talk+urlsegment --- regarding to the check if a county page exists and taking the example from ryans tutorial, you can do it like this: // we are only using 1 URL segment, so send a 404 if there's more than 1 if($input->urlSegment2) throw new Wire404Exception(); // now check if there is no urlSegment1 if($input->urlSegment1 == '') { // display main content ... } else { // get you a PageArray of all county pages using a appropriate selector. This depends on how you have setup things $countyPages = $pages->get("/path/to/countyparentpage/")->children(); // build an array of what you need to validate, titles or names ? (I use their names in the example here) $validCounties = array(); foreach($countyPages as $cp) { $validCounties[$cp->name] = $cp->name; } // now check if it is a valid county if(isset($validCounties[$input->urlSegment1])) { // display county content ... } else { // unknown URL segment, send a 404 throw new Wire404Exception(); } }1 point
-
I've used the 'double loop' in pluimveeweb on the right side with the "Kennispartners" logo's. Now there's only 1 partner but when there are 3 or more (2 logo's always visible) it'll get to the widest value possible for the widest logo. 336px / 2 = 168px. Here's some example code that will explain it better. $compress = 40; // heavier images compress more $x = 400; // box size, reference for image $y = 280; // box size, reference for image $max = 0; // calculation of the widests image, used to scale all others. // calculate max width all images ( settings as wide as possible ) foreach($partners as $partner) { $image = $partner->generic_logo; if($image instanceof Pageimage) { $box = $modules->get("ImageFitBoundaries"); $info = $box->load($image, $x, $y, $compress)->info(); $max = $max < $info['width'] ? $info['width'] : $max; } } $percent = 168 * 100 / $max; // 2 X 168 = 336px width of the column foreach($partners as $partner) { $image = $partner->generic_logo; if($image instanceof Pageimage) { $box = $modules->get("ImageFitBoundaries"); $info = $box->load($image, $x, $y, $compress)->info(); $width = (int) round($info['width'] / 100 * $percent); $height = (int) round($info['height'] / 100 * $percent); $options = array( 'quality' => 100, 'sharpening' => 'none' ); $thumb = $image->size($width, $height, $options); } } I'm really happy how much you've implemented so far and I think you should not over complicate the module. I think you should leave it how it is now. Thanks again for implementing weighten !1 point
-
No, it isn't in like you explained here, but it is somehow in without a double loop. But only when using a square boundary box and when the images are between the ratio aspects 1:2 -> 2:1. Images with more extreme ratio aspects are scaled none linear so that those are displayed smaller. So, the normal usage of weighten works like your description but is assuming the ratio aspect isn't wider than 2:1 / 1:2. When we add an additional param for the widest aspect ratio we should get the same effect as you described, I think. You first have to run a loop through the images, fetching their aspect ratios, and afterwards pass the highest value to the contain-weighten call. With images == photgraphs I think the average usage is well covered the way how it is setup now. But with logos it could be go much further with aspect ratios. Maybe you can drop in a small list of real logo usage aspect ratios (with extremes), so that I get a grasp of what we are talking here?1 point
-
Got it working. Here's my working code in case anybody is interesting (suggestions on improving it are welcome as I'm a ProcessWire newbie): $page_id = (int) $input->post->select_product; // page ID // Set a temporary upload folder where the files are stored during form processing // RC: precede temp dir with a period to ensure it remains non-web accessible //$upload_path = $config->paths->assets . "files/.temp/"; $upload_path = "/Applications/MAMP/htdocs/ProcessWire/site/assets/files/.temp/"; // RC: create temp path if it isn't there already if(!is_dir($upload_path)) { if(!wireMkdir($upload_path)) throw new WireException("No upload path"); } // show empty form if ($page_id) { $p = $pages->get($page_id); $template = $p->template->name; // this is the template where we will get the fields from // make a form $form = $modules->get('InputfieldForm'); $form->method = 'post'; $form->action = './'; $form->attr("id+name",'aanvraag-form'); // add the page's fields to the form $fields = $p->fieldgroup; foreach ($fields as $field) { $inputfield = $fields->{$field->name}->getInputfield($p); $form->append($inputfield); } // add template name field to the form $field = $modules->get("InputfieldHidden"); $field->attr('id', 'Inputfield_template_name'); $field->attr('name', 'template_name'); $field->value = $template; $form->append($field); // append the field // add select_product to the form $field = $modules->get("InputfieldHidden"); $field->attr('id', 'select_product'); $field->attr('name', 'select_product'); $field->value = $page_id; $form->append($field); // append the field // add a submit button to the form $submit = $modules->get('InputfieldSubmit'); $submit->name = 'save_new_aanvraag'; $submit->attr("value", "Go"); $form->append($submit); // only show the form if it was not just submitted/processed if (!$input->post->save_new_aanvraag) echo $form->render(); } // process the form if it was submitted if ($input->post->save_new_aanvraag) { // new wire upload $u = new WireUpload('images'); $u->setMaxFiles(2); $u->setMaxFileSize(200*1024); // tell it to rename rather than overwrite existing files $u->setOverwrite(false); $u->setDestinationPath($upload_path); $u->setValidExtensions(array('jpg', 'jpeg', 'gif', 'png')); // execute upload and check for errors $files = $u->execute(); if(!$u->getErrors()) { // now we assume the form has been submitted. // tell the form to process input from the post vars. $form->processInput($input->post); // validation $email = $form->get("email"); if ($email && (strpos($email->value,'@hotmail') !== FALSE)) { // attach an error and it will get displayed along the field $email->error("Sorry we don't accept hotmail addresses for now."); } // see if any errors occurred if (count( $form->getErrors() )) { // re-render the form, it will include the error messages echo $form->render(); } else { // successful form submission $np = new Page(); // create new page object $np->template = $form->get("template_name")->value; // set template $np->parent = $pages->get('/aanvraag/'); // set the parent $np->of(false); // turn off output formatting before setting values $np->save(); foreach ($np->fields as $f) { // do not sanitize or set Image and File fields here, because that will happen at the next step which will break if we do not skip images and files here if ($f->type == 'FieldtypeImage' || $f->type == 'FieldtypeFile') continue; echo $inputval = $form->get($f->name)->value; // sanitize fields if ($f->type == 'FieldtypePageTitle') { $sanitizer->text($inputval); // also set page name based on title $np->set('name', $sanitizer->pageName($inputval, true)); } if ($f->type == 'FieldtypeEmail') $sanitizer->email($inputval); if ($f->type == 'FieldtypeText') $sanitizer->text($inputval); if ($f->type == 'FieldtypeTextarea') $sanitizer->textarea($inputval); if ($f->type == 'FieldtypeInteger') $inputval = (int) $inputval; // attach fields to page $np->set($f->name, $inputval); } // add images upload foreach($files as $filename) { $np->images = $upload_path . $filename; } $np->save(); //create the page // remove all tmp files uploaded foreach($files as $filename) unlink($upload_path . $filename); echo "<p>Page saved.</p>"; } } else { // remove files foreach($files as $filename) unlink($upload_path . $filename); // get the errors foreach($u->getErrors() as $error) echo "<p class='error'>$error</p>"; } } else { //echo $form->render(); }1 point
-
Don't know if it is already in. But I used ImageFitBoundaries with a 'double' loop. Let me explane - looping several images through the Module and get the widest value. (No images are scaled, only values are returned) - then I search the widest image, and take the percentage it is compaired to the box. - I use that percentage to scale all images up.1 point
-
1 point
-
This module won't be continued as Blad and I are merging our modules into his one: https://processwire.com/talk/topic/7728-module-firststeps/1 point
-
1 point
-
1 point
-
Hello everyone It will be a pleasure working with you but give me 20 or 30 days. I work 15 hours a day and I can not now. I will return in a few days with a new video and fix my modules .1 point
-
@kongondo Sorry about the delay in completing my reply to your question about array size in PHP. I intended to post this link pretty quickly for you - but I got side-tracked.1 point
-
1 point
-
What about if you use this link: http://gdata.youtube.com/feeds/api/users/disney/uploads?orderby=updated&v=2&client=ytapi-youtube-rss-redirect&alt=rss That actually contains the thumbnail url. Note the "api", rather than "base"1 point
-
The node that contains an image is not there. The images are in a blob of HTML so it's hard to get those out. If you really want to get those out you could build the url to the image your self. The easiest way I see now is: Filter the video id out of the: // 76UvX8EKNZ8 is the ID <guid ispermalink='false'> tag:youtube.com,2008:video:76UvX8EKNZ8 </guid> Then use that id to build the url with: // Default image (small) http://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg // high quality http://img.youtube.com/vi/<insert-youtube-video-id-here>/hqdefault.jpg // medium quality http://img.youtube.com/vi/<insert-youtube-video-id-here>/mqdefault.jpg // standard definition http://img.youtube.com/vi/<insert-youtube-video-id-here>/sddefault.jpg // max resolution http://img.youtube.com/vi/<insert-youtube-video-id-here>/maxresdefault.jpg Keep in mind that not all images are available so propably you'll need a loop till you have an image and use a fallback if nothing is found. Second way: A second way I see is to search the <description> with PHP DOMDocument.1 point
-
I've seen this before. It happened when I disabled JavaScript on one of my sites. Can you confirm that JS is enabled for your site?1 point
-
@kathep, sorry if this was already answered; this is how i'm doing it (the random quote is shown on pages that are in a page select called landing_pages; quotes are stored as pages.. we use the title field for the name of the person, and the summary field for the quote text, so there is no markup (since in my design the quote is displayed in an h3 <?php $quote = $pages->find("template=quote, landing_pages=$page")->getRandom(); ?> <blockquote> <h3><?php echo nl2br($quote->summary)?></h3> <cite title=""><?php echo $quote->title?></cite> </blockquote>1 point
-
1 point
-
I think this Stack Overflow question + the answers is exactly what you need. In general, file versioning is definitely the way to go. It depends how your build process is though. Personally I use gulp with the gulp-rev package. There’s a pretty neat integration guide in the GitHub repo.1 point
-
Try this: <?php header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); ?> Or this with sunday as example: <meta http-equiv="expires" content="Sun, 01 Jan 2014 00:00:00 GMT"/> <meta http-equiv="pragma" content="no-cache" /> header('Expires: Sun, 01 Jan 2014 00:00:00 GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', FALSE); header('Pragma: no-cache'); You can also do random Generated Numbers on the files you dont want to be cached.1 point
-
I have updated the module to Version 0.1.0 beta and it has a new addition to the weighten option that can be used together with contain. The initial code I have taken for weighten calculations is from Martijn. I have changed it to simplify its usage so that you only need to specify a bounding square and have to switch it on, or additionaly prioritize landscape oriented images in two favours: x1, x2 or do the same for portrait oriented images with: y1, y2. (read more in the posts above) But if you (@Martijn ) like to use more different options, like with the original ImageFitBoundaries.module, you can use it by specifying different values for width and height together with the new value "comp##". For ## you set the value for compression like comp20, comp30, comp40 or whatever you like.1 point
-
Kudos, blad, this is impressive and has huge potential! The irony of the proposal to tailor these modules to end users/editors is, that at least in my experience all of my customers praised the ProcessWire backend for its self-explaining quality. Other CMS need such a tool 1000 times more, but haven't. ProcessWire got two of them within a few days1 point
-
You can do this: $userid = $users->get("$userName")->id; $ps = $pages->find("created_users_id=$userid");1 point
-
Actually, you can do this on the dev branch. Lets assume that cities are children of countries and that is reflected in your page structure (i.e. /countries/france/paris/). Create your 2 page fields (country and city), and configure 'country' as a single page field with "parent" set to "/countries/". Next, for the "city" field configuration, use the "Custom selector to find selectable pages", present on the "input" tab. In that field, enter "parent=page.country". Save and try it out. This works with select, selectMultiple and asmSelect fields (and possibly others), though not yet with checkboxes, radios or PageListSelect.1 point
-
Yes, it does work with Fieldsets. The first version doesn't work with tabs (FieldsetTab) though. I think this seems like a good idea Pete. I'll look into how best to implement in the next version. The first version I need to get committed to the dev source tomorrow (30th), so not planning to expand the scope of it this week, but moving forward, would like to continue expanding the dependencies system everywhere it makes sense. And your ideas here do seem like they could be very useful, and may not be very difficult to implement. Something to keep in mind is that dependencies are assumed to be things that can change during the course of filling out the form (i.e. if this field is populated, then this field is available, etc.). So when we get into things like user roles, we're talking about things that don't change during the course of the form. So these would be an entirely different kind of dependency. These would be dependencies that would be applicable before the form is actually rendered. They wouldn't need to be considered by the javascript dependencies at all. As a result, it really might make more sense for this capability to be something separate, at least from the code perspective.1 point