Jump to content

nbcommunication

Members
  • Posts

    286
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by nbcommunication

  1. Hi @jonatan, I'll have a think about how best to implement a lazy-load. I'll need to provide a way to return the "next" link to do this. The cache time is set in the module configuration, should be 3600 by default. Quite possible that the single request is maxing out the limit, will look at that later. Cheers, Chris
  2. Hi @jonatan, I'll provide a fuller response later but just a couple of things now: The API doesn't actually allow for querying a specific number of items like the old one did. The module actually uses the built in pagination to retrieve as many items as requested in the call. That's why it is taking a while. You should have a cache time of at least 3600 seconds (an hour) if you are requesting this many items. This will prevent maxing out the limits (which is a lot easier to do when developing anyway!). If I were in your position, I'd be weighing whether so many items need to be displayed. I'd probably just display the first batch (e.g. $images = $instagram->getMedia()) which returns 24 items normally. For the PHP error: <?php foreach($images = $instagram->getMedia(89) as $post) { ... } // I'd change this to: $images = $instagram->getMedia(89); if(count($images)) { foreach($images as $post) { ... } } Cheers, Chris
  3. Hi @gowthamg, The instructions for this module, for setting up the facebook app are here: https://github.com/nbcommunication/InstagramBasicDisplayApi/blob/master/README.md and relate exclusively to this part of the facebook/instagram docs: https://developers.facebook.com/docs/instagram-basic-display-api/overview#user-token-generator. I'd advise reviewing the errors displayed on your screenshot - notes and screencast are missing. If you do have success in getting the app reviewed and approved, please share here, but as I said previously, this isn't in the purview of this module. Cheers, Chris
  4. Hi @gowthamg - I can't help you here I'm afraid. This module and the instructions provided are not geared toward app review. Cheers, Chris
  5. Hi @gowthamg, What do you mean by all users? In the past, getting Instagram data from any user was pretty simple, but it is locked down now. You can only retrieve data from users who have authorised your app. This module is built around the oAuth token generator provided by facebook, which allows you to add a "test" Instagram user, and then generate a token by logging in as that user and authorising the app. This bypasses the need to submit the app for review, which is intended for apps that would be public facing. You can only get data from users that have authorised your app, and in this case of this module, you need to login as the user to authorise it. For a number of clients recently we've arranged a time where they change their password to something temporary and let us know the temp password, we run through the steps in the README and get the app/module set up, and then let the client know so they can change their password back. It has worked well so far. Cheers, Chris
  6. Hi @jonatan, Many thanks for your feedback, and for helping out @gowthamg. You are correct - looks like he's trying to set up the full API which isn't what this module uses. I've updated the README with the module call in each example, and also added an example for getMedia() which demonstrates how to build a multi-media gallery using UIkit. I've attached a video example of the result ? Here's the code I added to the README: // Function for rendering items function renderInstagramItem($src, $alt, $href = null) { if(is_null($href)) $href = $src; return "<a href='$href' data-caption='$alt' " . ($src !== $href ? "data-poster='$src' " : "") . "class='uk-display-block uk-cover-container'>" . "<canvas width='640' height='640'></canvas>" . "<img src='$src' alt='$alt' data-uk-cover>" . "</a>"; } // Get the module $instagram = $modules->get("InstagramBasicDisplayApi"); // Get the 16 most recent items and render them based on type $items = []; foreach($instagram->getMedia(16) as $item) { switch($item->type) { case "VIDEO": $items[] = renderInstagramItem($item->poster, $item->alt, $item->src); break; case "CAROUSEL_ALBUM": // If 4 or greater items, display a grid of the first 4 images // Otherwise display the main image (no break, moves to default) if($item->children->count() >= 4) { $items[] = "<div class='uk-grid-collapse uk-child-width-1-2' data-uk-grid>" . $item->children->find("limit=4")->each(function($item) { return "<div>" . renderInstagramItem($item->src, $item->alt) . "</div>"; }) . "</div>"; break; } default: // IMAGE $items[] = renderInstagramItem($item->src, $item->alt); break; } } // Render the items as a grid echo "<div class='uk-grid-collapse uk-child-width-1-2 uk-child-width-1-4@s' data-uk-grid data-uk-lightbox>"; foreach($items as $item) { echo "<div>$item</div>"; } echo "</div>"; The query about data-width - this is a totally separate thing unfortunately. That's the oEmbed implementation from which you get a HTML embed code which normally includes javascript from the provider, and in the case of Instagram includes code which handles a data-width attribute. There's nothing like that here. This API gives you basic data, and it is up to you to render it. I'd actually recommend looking more into oEmbed if you are looking to embed single posts in articles or similar. The main purpose of this module and the API itself is a standalone "feed" or gallery of user media. Cheers, Chris instagram-basic-display-api-2020-03-21.mp4
  7. Hey, If anyone has installed and implemented this module, please let me know if you've any feedback! I've currently only used it as a replacement for InstagramFeed, and it has worked great ? Cheers, Chris
  8. Hi @Ben Sayers, The `src` returned is a direct link to the image on Instagram's CDN - there are no API options for resizing. When I've used a lightbox I just use `src` for both the "img src" and "a href" attributes. Cheers, Chris
  9. Hi Ben, Glad to hear you got the account authorised ? Pop this before your call: $instagram = $modules->get("InstagramBasicDisplayApi"); Cheers, Chris
  10. Hello, With the API being deprecated at the end of this month, I've built a replacement module which uses the Instagram Basic Display API. Find out more here: Cheers, Chris
  11. Hi, The module is now ready for use in production. It is still in Beta as I need to test token renewal, but cannot do this yet due to how token renewal works. Cheers, Chris
  12. Hi @lpa, Apologies for the late response. I've had a look at this... Number 2 - width and height attributes not rendering - this isn't anything to do with PageimageSrcset. These options, when passed to Pageimage::render(), resize the image, but don't get rendered as attributes. If you want this behaviour, adding a markup option should do the trick: $content .= $img->render([ 'alt'=> $img->name, 'height' => $img->height, 'width' => $img->width, 'srcset' => '883, 687, 369', 'markup' => "<img src='{url}' alt='{alt}' width='{width}' height='{height}' />" ]); As for portrait mode, I'm not getting this when I test. I get: <img src='/site/assets/files/1033/placeholder-city.691x499.1000x667.webp' alt='placeholder-city.jpg' srcset=' /site/assets/files/1033/placeholder-city.369x266-srcset.webp 369w, /site/assets/files/1033/placeholder-city.687x496-srcset.webp 687w, /site/assets/files/1033/placeholder-city.691x499.webp 883w' > In your example, the image isn't being resized as portrait, so it is odd that the sizes attribute is being added. What settings do you have in the module config for Portrait mode? Are you on the latest version of the module (1.01)? Cheers, Chris
  13. Thanks @LAPS, have added that to my master copy and will add it to the repo soon.
  14. Hi @LAPS, Have a look at new() in WireMailTools. This is where the WireMail module is set either explicitly through a passed option or config setting, or inferred. Going by your first post, I think you may be able to set $config->wireMail, so it just uses default WireMail. Cheers, Chris
  15. @LAPS, @adrian - I only use WireMailgun and don't use ProMailer, so I'm not the best person to check with... However, as I understand it, any WireMail module installed supersedes the core WireMail functionality. For example, system error / forgot password emails we receive are sent through Mailgun. I've no idea how multiple WireMail modules are handled, but I assume that ProMailer gives you the option to choose which to use? Cheers, Chris
  16. Hi, this module is now in Beta. Still to add full documentation and Facebook App tips. Aiming to complete by the end of the week!
  17. Hi, I've updated this module with a lot of progress - still should be considered alpha, but should be ready for production soon. Cheers, Chris
  18. Hi @montero4, That all makes sense. You can also do the following: // Create an image variation 1200px wide with -srcset suffix $image = $page->image->width(1200, ["suffix" => "srcset"]); echo "<img src='$image->url' alt='$alt_text' srcset='$image->srcset'>"; // PageimageSrcset will use the original to generate the srcset value If you have a look at the Pageimage options, you can add a suffix to the filename when resizing. Cheers, Chris
  19. Hi @montero4, I'm sorry, I'm still not following? There's nothing stopping you changing the src - you should resize the image first: // Get the image $image = $page->images->first; // Resize the image $image = $image->size(1024, 468); // Output the image echo "<img src='$image->url' alt='$image->description' srcset='$image->srcset'>"; // Or alternatively echo $image->render(); PageimageSrcset recognises that it is an image variation and then uses the original to generate srcset variations. It isn't really this module's job to handle the src attribute. In theory you could do some manipulations of the "srcset" value to extract the first or last image for use, but I'd say it is a lot cleaner just to resize the image. Cheers, Chris
  20. For folk using the module - is the configuration of sets in the textarea working OK for you? I've been mulling over trying to build something a bit more user-friendly, like a kind of repeater field for entering data, but I'm not convinced that it would actually be easier to work with, particularly as I usually only enter an image width per line and that's it. In a future version I want to add the configuration on a per-field basis (maybe even per-image even though that would be overkill), so I want to get the configuration method as solid as possible first. Perhaps retaining the textarea, but with a live preview would be the best option? I'm also not sure whether it is useful to have portrait mode and UIkit widths as config options. Ultimately the module is meant to extend Pageimage so that srcset and sizes can be used - I feel these config options are a result of my own bias in how I use the module, and yet I don't think I've used the portrait option at all! Any ideas/thoughts you have, please come with them! Cheers, Chris
  21. Hi @adrian, Finally gotten a look - it was as I expected. When an email address is passed to WireMail::to() it is run through WireMail::sanitizeEmail(). This passes the email through both strtolower() and trim(). addRecipientVariables() was just using Sanitizer::email(), which doesn't pass the email through strtolower/trim, resulting in different keys. I've changed it to use sanitizeEmail(). Sorry it's taken so long to fix! Cheers, Chris
  22. Hi, With the deprecation of Instagram's API and therefore the end of the Instagram Feed module, I've developed a replacement module which uses the Instagram Basic Display API: https://github.com/nbcommunication/InstagramBasicDisplayApi To use this module you'll need: ProcessWire >= 2.7 A Facebook Developer account Access to the Instagram user account you wish to use Prior to installation, you'll need to create a Facebook app. The app you will create uses the User Token Generator for authentication - it does not need to be submitted for App Review (and therefore stays in Development mode). The README contains full instructions on how to create and set up the app and also how to use the module. The primary reason for this module's development was to retain functionality on existing websites that use the Instagram Feed module. To assist with upgrading, this module replicates some methods provided by Instagram Feed. I've already upgraded a couple of sites and it was quick and painless ? Cheers, Chris
  23. @teppo, having read a bit about <picture>, it probably would make sense to provide this functionality in the module, but possibly as a separate method distinct from render(). I’ve got a fair bit I want to do on this module, but it’s behind a lot of other work at the moment. I’ll add this to the todo list, but for the time being, I would go with writing something for your own use. Cheers, Chris
  24. Hi @montero4, Can you please give a code example? From your description, it seems to me that all you need to do is resize the pageimage before rendering/getting attributes. Cheers, Chris
  25. Hi @teppo, I've not used <picture> myself, so will need time to do a bit of research. Off the top of my head though, I do feel that this module wouldn't necessarily be the best place for it. When I get a chance I'll have a think through the implications. Cheers, Chris
×
×
  • Create New...