Jump to content

jacmaes

Members
  • Posts

    281
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by jacmaes

  1. I'm working on a photographer's site. My tree is organized as such: Home --Photography ----Abstractions ------Photo 1 (photo on its own page; template: portfolio_image) ------Photo 2 ----Animals ----Signs ----etc. --Places: ----United States (template: country) ------New Jersey (template: state) --------Newark (template:city) --------Ringwood --------etc. ------New York In each photo's page (e.g. "Photo 1"), I have a page reference field name "city" where I can select the city (e.g. "Newark"). Now in "Places", I'm trying to retrieve all the photos in each country, for example all pics taken in the United States. I need to find the grandparent of "city", i.e. the country where that city belongs to, but "city.has_parent=$country" or "city.parent.parent=$country" don't work: <?php $foreach ($page->children as $country): $photos_by_country = $pages->find("template=portfolio_image, city.has_parent=$country"); foreach ($photos_by_country as $photos): echo $photos->title; endforeach; endforeach; ?> What's the selector for "the grandparent of the city field" is…? Thanks for your help.
  2. From a quick look, I see a typo here: <? foreach($page->we as $member); ?> It should be: <? foreach($page->we as $member): ?> Notice ":" instead of ";"
  3. I did a couple of years ago. It worked fine with three caveats: by default it caches all the pages and files it rewrites, so you have to be mindful of not running out of disk space. I'm not really comfortable letting an automated tool rewrite so much markup. I like to control the output. you can spend a lot of time tweaking and testing all the settings if you're not opting for the default ones. One particular problem I ran into is to exclude image rewrites from the admin. I believe it's possible to exclude directories, but I could not get it to work and it caused all sorts of unforeseen issues, such as images in Ckeditor fields. In the end, I removed it because it was not worth the hassle. I had already implemented on my own all the major optimizations it proposed to do automatically. Like you, I was mostly interested in the WebP conversion anyway. In case you're not aware, @horst is working on implementing WebP in PW.
  4. FYI: Today, January 29, Firefox 65 is out with WebP support. The only major browser left with no WebP support is Safari.
  5. My thoughts exactly. A video + a code console to play with the API, as mentioned before, would be much more effective.
  6. @horst Niiiice! I've just tried on a live server with PHP 7.2 installed. Your code works great. The Webp image is successfully generated from the original JPEG. Here's how I've echoed it: $main_image = $page->image->first->getCrop('grande'); // (using Horst's Croppable Image module in this example) $image = imagecreatefromjpeg($main_image->filename); imagewebp($image, str_replace('.jpg', '.webp', $main_image->filename)); imagedestroy($image); $webp_image = str_replace('.jpg', '.webp', $main_image->url); echo "<img class='responsive-image' src='$webp_image' alt=''>"; Note: for those using the Plesk control panel, webp support for GD seems to be disabled by default.
  7. Yes, imagemagick supports it: https://imagemagick.org/script/webp.php Thanks @horst!!
  8. I think the Cloudinary image conversion service (they have a generous free tier) could take care of the conversion. They support TIFF. You can use their Fetch method to remotely transform your TIFFs.
  9. @Mikel Pretty sure you can’t subscribe to a list you previously unsubscribed from. It’s a Mailchimp “feature”.
  10. @mel47 Try removing “async defer”.
  11. As @bernhard said, the UI is really nice. It's clever, smooth and minimal, and only shows a wealth of options when you actually need them.
  12. @flydev the clear log button will be helpful, thanks. I have one request: when upgrading to the latest version, I have to manually move the SDK files from the old folder (starting with a dot: ".Duplicator") to the new, updated one. Is there a way to automate this task? It's easy to do manually but I have to remember to do it each time I upgrade.
  13. Goddady's PHP version: 5.4. Good news: Google Drive works flawlessly on my VPS. This is great, thanks @flydev !
  14. The latest dev, 3.085. Maybe curl support is restricted on Goddady, which wouldn't surprise me considering my (awful) experience with them. I'm trying on another server (VPS). So far I'm not getting this error message.
  15. Sorry, I should have checked the docs first. I'm getting the following error with Google Drive: Error: Call to undefined function GuzzleHttp\Handler\curl_reset() (line 78 of /home/mydomain/public_html/site/site/modules/Duplicator/SDKs/google-api-php-client-2.2.0/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php) This site is hosted on a cheap, shared Godaddy account by the way.
  16. @flydev I've uploaded the "Duplicator-SDKs" folder via FTP into the "Duplicator" folder in the modules directory, but the checkbox for Google Drive (I'm only interested in this SDK, not Amazon's) stays greyed out. Is there something else I should do?
  17. @flydev The FTP issue that I was having a few versions back has been resolved with the recent updates. Thanks!
  18. Thanks @flydev for your work on this module. I keep getting the following error when trying to use FTP: "[FTP] error: invalid file 2017-12-04_07-01-36-glosas.anle.us.package.zip, bad extension" I don't understand what "bad extension" means. I've tried leaving the Name field for the backup file blank (default state), and changing it also (which by the way seems to have no effect), but I get the same error. Another question: are you going to upload the Google Drive SDK? I get a 404 error when clicking on "you can download it here..." Thanks.
  19. Thanks a million, @kongondo ! You pointed me to the right direction. In the end I had to loop through the $all_options as you anticipated. The following works: // get the Select Options Field $field = $fields->get('licences'); // get all the defined options $all_options = $field->type->getOptions($field); foreach($all_options as $licence) { // check 'checked' status $checked = $user->licences->get("id={$licence->id}") ? ' checked': ''; $my_form .= "<label for='$licence->id'> <input name='carnet_de_conducir[]' type='checkbox' id='$licence->id' value='$licence->id' $checked>$licence->title</label>"; } After hours of wasted sleep and overengineered failed attempts, here you come to save the day with this classically elegant and readable PW snippet. I'm so grateful ! Gottta love this forum.
  20. I'm sure it's been asked before on the forums, but I haven't found a relevant answer after multiple searches. I have a form on the frontend that mirrors the user profile on the backend. After logging in, I want the user to be able to edit multiple fields on his or her profile. For simple text entries (e.g. First Name, Street Address, Phone Number or Email), and single options (e.g. radio buttons for Gender: male or female or select dropdowns for a Country list), I have no issue and everything works fine: the user first fills out the form then can go back and update whichever field they want. That's standard profile editing stuff from the frontend. But I hit a roadblock when I want to offer multiple choices. For example, I have a Select Options field set up to show multiple checkboxes for choosing various types of driver's licences. With the following code (edited for brevity): $licence_types = array('B1', 'B', 'A1', 'C1', 'D1'); // same options as defined in my select options field foreach($licence_types as $licence) { $content .= "<label><input type='checkbox' name='licences[]' value='$product'> $licence</label>"; } .... $user->of(false); $user->licences = $licences; $user->save(); $user->of(true); the user can successfully submit this info from the frontend form: But now how do I show them the result of what they submitted when they go back and want to update their profile from the same form? In other words, how do I insert the checked='checked' (or simply 'checked') HTML in the previously selected checkboxes? For example, if they selected the first two options –B1 and B– in the example above, how do I make these two checkboxes ticked? With the following loop, I can show the previously selected checkboxes: foreach($user->licences as $licence) { $content .= "<label for='$licence->id'> <input name='licences[]' type='checkbox' id='$licence->id' value='$licence->id' checked>$licence->title</label>"; } How do I merge the two loops so that they see this, as expected: Maybe with in_array()? Any help would be greatly appreciated.
  21. I'm wondering the same thing... Seems strange coming from such a dedicated team.
  22. You should be able to use the "data-uk–*" prefix and have it pass the HTML validation. See the docs here, under the "Component usage" heading: https://getuikit.com/docs/javascript I understand that according to the spec, HTML5 custom data attributes should be prefixed as such, with "data-*": https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-*
  23. Like @Falk and @Macrura I sometimes have the same, forever-spinning loading behavior, especially with images that are at least larger than 3000 pixels.
  24. I've used the code on this tutorial for at least 4 or 5 sites, and it's rather easy to tweak for your needs. (You can pay for the full source code if you want to reward the developer for his work, but you don't have to: you can copy and paste the various parts needed).
  25. @Macrura thanks, I can confirm that I no longer have the issue after downloading the module from Github manually.
×
×
  • Create New...