Jump to content
kongondo

Visual Page Selector (commercial page picker module for ProcessWire)

Recommended Posts

17 hours ago, mikhail said:

Though I can see already that I will need to make adjustments to how large you are showing the thumbnail images in listing view, in addition to the width of the additional column.

OK. Suggestions? However, I noticed that in Thumbs Grid view, if for some reason ProcessWire fails to properly create an image thumb 260px high, some crazy-wide images will be displayed. I ran into this in Media Manager which I am currently upgrading. I have made changes there and will do so in VPS as well.

17 hours ago, mikhail said:

There is also a bit of a weird UI thing happening with a line showing through the title field (Firefox, Win10) in the following non-listing view-

That is weird! I'll have a look. I don't have Win10 though... (blissfully stuck on Win7 :))

Share this post


Link to post
Share on other sites

Suggestions?  Sure- here's my particular use-case which highlight the reasons why I would need to modify VPS's admin behavior-

I am using this for panoramic images that I create. So they are much wider than they are tall. This means that in thumbnail-list view the default preview images have very little height to them, making it more difficult to see what they are. I would need to at least double the present width in order to make the images easier to identify.

Also in "list view"- one can add columns to the right to include field data such as name, title etc. In my case, I use three columns of data- the image "TITLE" ( short unique ID's ~10 char), a relatively short (~20 char) category, and a proper NAME (~70+ char). When I include these fields, the added columns are presently evenly spaced. Resulting in a much wider column than necessary for the TITLE, a wider column than is necessary for the CATEGORY, and a column that is too small for the NAME (causing it to wrap). Perhaps a way to designate percentage widths for these columns would be a great addition?
 

Capture.JPG

Share this post


Link to post
Share on other sites
55 minutes ago, mikhail said:

default preview images have very little height to them, making it more difficult to see what they are. I would need to at least double the present width in order to make the images easier to identify.

Going forward, I have been thinking for adding the 'resize' slider like in ProcessWire's image field so that the user can select their default preview size.

55 minutes ago, mikhail said:

Perhaps a way to designate percentage widths for these columns would be a great addition?

I wanted to implement this in the last version but ran out of time. I would like to incorporate the input for the percentage widths right within or next to the respective column definitions (in the asmSelect). I'll have a think, thanks

50 minutes ago, mikhail said:

Regarding the odd UI "bug" I showed. I am using the UIKit Admin style. Perhaps that might be the source of it?

I use the same theme, although I test in all themes. I'll test some more, starting with FF.

 

Share this post


Link to post
Share on other sites

Great fan of the module! However, I haven't yet gotten it to work for non-superusers. The modal for selecting pages aborts with an error »ProcessWire: Unrecognized path« and »The process returned no content.«

Now I guess it has to do with them not having the required permissions to access the root Admin page, but is there another way to allow editors to use the module?

Share this post


Link to post
Share on other sites

Me again. Sorry for wasting your time 🤡Everything is working as expected now.

I overlooked the vps permission and only now found it — after stumbling through this support thread.

Share this post


Link to post
Share on other sites
2 hours ago, d'Hinnisdaël said:

Great fan of the module!

Glad you like it 🙂

2 hours ago, d'Hinnisdaël said:

Everything is working as expected now.

Good to hear you got it sorted.

2 hours ago, d'Hinnisdaël said:

after stumbling through this support thread.

Not so great on my part then 🙁. It seems I should be more clear that this thread exists 🙂.  Docs are also here. They do mention the vps permission in the very first chapter.

Share this post


Link to post
Share on other sites

Hi @kongondo, Hope all is well!

Running into a couple of glitches here with VPS, and these were discovered in a meeting yesterday, more or less watching the client/users interacting with the field and having to sort of 'apologize' for the complexity and/or the peculiarities of the field.

To sum up the current issues:

(1)

It seems that when adding an item to the field, there is some sort of ajax save going on (?) - this is contrary to a standard page field where the stored value of the field is not modified until the page is saved. The issue here is that the frontend is possibly updating to reflect that saved state of the field, prior to the user having a chance to save the page. 

An example use case illustrating why this is a problem would be say if your field is being used for selecting slides for a slider. The user may want to add slides, remove others, reorder the slides, possibly edit the slides all prior to wanting these changes to be reflected in the front end. With the current behavior, the newly added items appear on the front end prior to the user saving the page, and they found this to be unexpected behavior.

(2)

Users are still confused about the process of adding items from the lister.

One issue is that they don't know when/if an item is selected, as there appears to be no indicator of that at the row level, so they would select something, then inadvertently unselect it in a vain attempt to get some visual feedback that the item they want is selected; Once they have an item selected, they need to scroll to the top of the modal window, and hit the plus button to get the item to add to the field. Not sure how else this could be handled but it is something they also have to remember rather than it being intuitive.

(3) the process of removing items is also a 2 step process – they have to trash the item, then hit the remove button; this is fine, and as long as i add instructions on the top of the field it should be ok; But maybe there should be some visual feedback once they have 1 or more items selected for trashing that they now need to click the X button to actually remove them – saving the page with those items marked for trash (which would be the images field behavior) does not seem to remove them, so this inconsistency between similar looking fields is also causing confusion among the users.

Currently I don't know of any better way than this field to allow these users to select items (such as images, videos, or other image driven content). The ability for them to use a lister to select items is great, and once you get used to the steps, it's basically fine, though some small tweaks that might address some of the current concerns could be nice polish for this.

But currently the fact that items are pushed to the front end without users saving is the biggest issue that I need to resolve for this particular project/scenario..

Share this post


Link to post
Share on other sites
1 hour ago, Macrura said:

there is some sort of ajax save going on

That's correct. We use Ajax to avoid reloading the page (and potentially losing other unsaved work on the page).

1 hour ago, Macrura said:

The issue here is that the frontend is possibly updating to reflect that saved state of the field

Yes, it does.

1 hour ago, Macrura said:

With the current behavior, the newly added items appear on the front end prior to the user saving the page, and they found this to be unexpected behavior.

I'll have a think.  It would have to be configurable (in the field's settings) in order to preserve backward compatibility.  This means the default behaviour will be the current behaviour.

 

1 hour ago, Macrura said:

they don't know when/if an item is selected, as there appears to be no indicator of that at the row level, so they would select something

There are two visual indicators. One, the background of the selected (table) row is highlighted (light grey). The total number of items selected are shown at the top of the results. Maybe the light grey background is too subtle? Which Admin Theme are you using? 

1 hour ago, Macrura said:

Once they have an item selected, they need to scroll to the top of the modal window, and hit the plus button to get the item to add to the field

I got this feedback RE Media Manager as well. The only solution I could think of was floating add and remove buttons. I haven't gotten round to coding one yet.

1 hour ago, Macrura said:

saving the page with those items marked for trash (which would be the images field behavior) does not seem to remove them,

Yes, you are right, marking items for removal alone will not remove them.

1 hour ago, Macrura said:

so this inconsistency between similar looking fields is also causing confusion among the users.

I get your point, but I am not sure how to deal with this one. I don't want to change the behaviour now and break backward compatibility. I'll have a think whether to make this configurable as well, i.e. current behaviour (2-step process) versus "marked/selected image will be deleted on save";

Share this post


Link to post
Share on other sites

is there any way to add an attribute to the items that are added by ajax save so i can do a check on the front end, and that would solve that.. not sure, just thinking out loud.. Maybe i need to hook somehow..

This is using AdminThemeUIKit; i will check again to see if the background changes on this one.

Share this post


Link to post
Share on other sites
7 minutes ago, Macrura said:

This is using AdminThemeUIKit;

That's what I am using as well. I remember going back and forth with the background colour and settled for the grey to "fit the surroundings".

9 minutes ago, Macrura said:

is there any way to add an attribute to the items that are added by ajax save so i can do a check on the front end, and that would solve that.. not sure, just thinking out loud.. Maybe i need to hook somehow..

No there isn't and it still wouldn't work since the details are saved in the database like any other Pagefield. Reloading the page will just load what's already in the database. Making this configurable is the way to go. You would still see the added items in the inputfield, but if you reloaded the page without saving, the changes would be lost. How soon do you need this?

Share this post


Link to post
Share on other sites

no huge rush, configurable sounds cool.. thanks!

  • Like 1

Share this post


Link to post
Share on other sites
5 hours ago, Macrura said:

no huge rush, configurable sounds cool.. thanks!

OK, we have #1 configurable and working fine (Ajax Save Yes/No). The page is added to the inputfield but not saved to the field. Such pages can be re-positioned, edited, etc, just like the other saved pages. In the frontend, they do not show up since they are not saved to the field yet. On save, the pages are added to the field. If the page is manually reloaded without saving, these pages are not saved to the field. The only snafu is that when the pages are added to the modal, in case one is not using "Close Modal On Add Page", there is no visual indication (the light grey background on table rows or if using Thumbs View, the greenish border) that the pages are in the field, which sort of makes sense because they are not yet saved to the field. However, I think they should be presented as if they are in the field. I'm not sure how to resolve this atm. Thoughts? 

Thanks. 

  • Like 1

Share this post


Link to post
Share on other sites
4 hours ago, kongondo said:

The only snafu is that when the pages are added to the modal, in case one is not using "Close Modal On Add Page", there is no visual indication (the light grey background on table rows or if using Thumbs View, the greenish border) that the pages are in the field, which sort of makes sense because they are not yet saved to the field. However, I think they should be presented as if they are in the field. I'm not sure how to resolve this atm.

sounds tricky... not sure about that;  don't want to make it too hard for you, so hopefully this doesn't present issues... I do see the underlying snafus with the modal being a separate process which needs to communicate with the page and the field specifically to display status of the items in the lister... but i don't know enough about how that's working;

in the case of these users that i'm working with, they are flexible enough that if i explain how something works, they can handle some small amount of quirkiness here and there, so i can just let them know that the list won't really reflect which items are already in the field...

Share this post


Link to post
Share on other sites

Visual Page Selector version 006  (released (18/02/2019)

Happy to announce that the latest release of Visual Page Selector is now available for Download/Purchase.

Thanks to suggestions by @Macrura, this version includes a number of improvements one of which will require clients to relearn one thing (sorry).

Changelog

  1. Ajax vs Manual Save: You can now choose whether pages added to inputfield should be immediately saved to the pagefield (via Ajax) [the default behaviour] versus have them added in a sort of "pending state". If the latter, pages will be added to the inputfield (for visual purposes) but will not be saved to the pagefield until the page you are editing is manually saved. In the modal, visually, the pages are presented as if they are in the field (i.e. similar to pages saved in the field). In the inputfield, a pending page behaves like other pages saved in the field; they can be reordered, edited, etc. This feature has several advantages including the fact that changes can be made to the page without immediately being reflected in the frontend. Please note that reloading the page being edited without saving will discard pending pages!  The setting is in the Input Tab  (Modal Settings) when editing the field.
  2. Trash Icon: VPS Inputfield (Thumbs View) now behaves like a PW image field in relation to deleting pages in the page field. To delete an image from a PW image field, the process simply involves marking an image for deletion by clicking on its trash icon and saving the page. Previously, VPS (Thumbs View) has required two steps (in multi-page fields); first to mark an image for deletion by clicking on its trash icon and finally clicking on the remove icon (x). In single page fields, there was no icon altogether. It required clicking on the remove icon (x). Hence, these similar actions behaved differently from each other and from PW image fields (which VPS in Thumbs View seeks to emulate and enhance). With this update, VPS now behaves similar to PW image fields across the board. To remove pages from a pagefield using VPS, simply click on their trash icons and save the page. We have removed the remove icon (x). Unfortunately clients will have to be re-taught about this change but I think the benefits outweigh the inconvenience. 
  3. Modal Lister View: We've improved the visibility of pages selected for adding to a VPS inputfield. The light grey background did not provide enough contrast. We've gone for a light red (pink?). 
Edited by kongondo
  • Like 4

Share this post


Link to post
Share on other sites

wow awesome, thanks a million! Will get this downloaded and installed and let these particular users know, they will be happy!

Edit:  So how do i get this, i can't seem to find my order number, or the email receipt i was sent.. Also, i think my subscription expired?

Share this post


Link to post
Share on other sites
On 2/18/2019 at 5:46 PM, Macrura said:

So how do i get this, i can't seem to find my order number,

Please check your PM.

On 2/18/2019 at 5:46 PM, Macrura said:

i think my subscription expired?

In that case, you'll need to renew it here using the details I've sent you.

Thanks.

Share this post


Link to post
Share on other sites

Can't trash items in version 6 –  click trash on the item, save and it stays put.

Share this post


Link to post
Share on other sites
49 minutes ago, Macrura said:

Can't trash items in version 6 –  click trash on the item, save and it stays put.

That's very strange. It works here. PW version, PHP version?

Share this post


Link to post
Share on other sites

@Macrura

As you can see, it works here:

vps-version-003-inputfield-trash.thumb.gif.cd033e62e5a121688f64d54168e8cf08.gif

 

Does your version look like mine above? It needs JavaScript to work. I have a feeling your browser is serving the cached JavaScript files rather than the updated ones. Please clear your browser cache and/or test in incognito. Thanks.

Edited by kongondo

Share this post


Link to post
Share on other sites

thanks, ok yes that was it, i force reloaded the page  (not in modal) and was able to uncache the js.

Share this post


Link to post
Share on other sites
14 minutes ago, Macrura said:

thanks, ok yes that was it, i force reloaded the page  (not in modal) and was able to uncache the js.

😉👍

Share this post


Link to post
Share on other sites

Very strange display issue here...

Images display correctly in list view...

2019-06-04_19-34-46_g7hzf.thumb.jpg.56b90b4335d5b94087ad0734afdee7c8.jpg

... but some images fail in thumbnail view:

2019-06-04_19-34-10_2x26e.thumb.jpg.c108877e6c92a476ecc5df3dbf0e438e.jpg

Any ideas?

Share this post


Link to post
Share on other sites
15 minutes ago, dynweb said:

Any ideas?

My mistake sorry. It is definitely related to this identical issue reported for Media Manager 🙂. I'll sort it out ASAP.

Thanks for reporting.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Gadgetto
      Status update links (inside this thread) for SnipWire development will be always posted here:
      2019-08-08
      2019-06-15
      2019-06-02
      2019-05-25
      If you are interested, you can test the current state of development:
      https://github.com/gadgetto/SnipWire
      Please note that the software is not yet intended for use in a production system (alpha version).
      If you like, you can also submit feature requests and suggestions for improvement. I also accept pull requests.
      ---- INITIAL POST FROM 2019-05-25 ----
      I wanted to let you know that I am currently working on a new ProcessWire module that fully integrates the Snipcart Shopping Cart System into ProcessWire. (this is a customer project, so I had to postpone the development of my other module GroupMailer).
      The new module SnipWire offers full integration of the Snipcart Shopping Cart System into ProcessWire.
      Here are some highlights:
      simple setup with (optional) pre-installed templates, product fields, sample products (quasi a complete shop system to get started immediately) store dashboard with all data from the snipcart system (no change to the snipcart dashboard itself required) Integrated REST API for controlling and querying snipcart data webhooks to trigger events from Snipcart (new order, new customer, etc.) multi currency support self-defined/configurable tax rates etc. Development is already well advanced and I plan to release the module in the next 2-3 months.
      I'm not sure yet if this will be a "Pro" module or if it will be made available for free.
      I would be grateful for suggestions and hints!
      (please have a look at the screenshots to get an idea what I'm talking about)
       




    • By apeisa
      Update 31.7.2019: AdminBar is now maintained by @teppo. Modules directory entry has been updated, as well as the "grab the code" link below.
      ***
      Latest screencast: http://www.screencas...73-ab3ba1fea30c
      Grab the code: https://github.com/teppokoivula/AdminBar
      ***
      I put this Adminbar thingy (from here: http://processwire.c...topic,50.0.html) to modules section and to it's own topic.
      I recorded quick and messy screencast (really, my first screencast ever) to show what I have made so far. You can see it from here: http://www.screencas...18-1bc0d49841b4
      When the modal goes off, I click on the "dark side". I make it so fast on screencast, so it might seem a little bit confusing. Current way is, that you can edit, go back to see the site (without saving anything), continue editing and save. After that you still have the edit window, but if you click "dark side" after saving, then the whole page will be reloaded and you see new edits live.
      I am not sure if that is best way: there are some strengths in this thinking, but it is probably better that after saving there shouldn't be a possibility to continue editing. It might confuse because then if you make edits, click on dark side -> *page refresh* -> You lose your edits.
      ***
      When I get my "starting module" from Ryan, I will turn this into real module. Now I had to make some little tweaks to ProcessPageEdit.module (to keep modal after form submits). These probably won't hurt anything:
      if($this->redirectUrl) $this->session->redirect($this->redirectUrl); if(!empty($_GET['modal'])) $this->session->redirect("./?id={$this->page->id}&modal=true"); // NEW LINE else $this->session->redirect("./?id={$this->page->id}");   and...
      if(!empty($_GET['modal'])) { $form->attr('action', './?id=' . $this->id . '&modal=true'); } else { $form->attr('action', './?id=' . $this->id); // OLD LINE }  
    • By Mike Rockett
      Jumplinks for ProcessWire
      Release: 1.5.54
      Composer: rockett/jumplinks
      Jumplinks is an enhanced version of the original ProcessRedirects by Antti Peisa.
      The Process module manages your permanent and temporary redirects (we'll call these "jumplinks" from now on, unless in reference to redirects from another module), useful for when you're migrating over to ProcessWire from another system/platform. Each jumplink supports wildcards, shortening the time needed to create them.
      Unlike similar modules for other platforms, wildcards in Jumplinks are much easier to work with, as Regular Expressions are not fully exposed. Instead, parameters wrapped in curly braces are used - these are described in the documentation.
      Under Development: 2.0, to be powered by FastRoute
      As of version 1.5.0, Jumplinks requires at least ProcessWire 2.6.1 to run.
      View on GitLab
      Download via the Modules Directory
      Read the docs
      Features
      The most prominent features include:
      Basic jumplinks (from one fixed route to another) Parameter-based wildcards with "Smart" equivalents Mapping Collections (for converting ID-based routes to their named-equivalents without the need to create multiple jumplinks) Destination Selectors (for finding and redirecting to pages containing legacy location information) Timed Activation (activate and/or deactivate jumplinks at specific times) 404-Monitor (for creating jumplinks based on 404 hits) Additionally, the following features may come in handy:
      Stale jumplink management Legacy domain support for slow migrations An importer (from CSV or ProcessRedirects) Feedback & Feature Requests
      I’d love to know what you think of this module. Please provide some feedback on the module as a whole, or even regarding smaller things that make it whole. Also, please feel free to submit feature requests and their use-cases.
      Note: Features requested so far have been added to the to-do list, and will be added to 2.0, and not the current dev/master branches.
      Open Source

      Jumplinks is an open-source project, and is free to use. In fact, Jumplinks will always be open-source, and will always remain free to use. Forever. If you would like to support the development of Jumplinks, please consider making a small donation via PayPal.
      Enjoy! :)
    • By nbcommunication
      I've spent the last while experimenting with srcset implementation - and PageimageSrcset is the result:
      PageimageSrcset
      Provides configurable srcset and sizes properties/methods for Pageimage.
      Overview
      The main purpose of this module is to make srcset implementation as simple as possible in your template code. It does not handle images rendered in CKEditor or similar fields.
      For an introduction to srcset and sizes, please read this Mozilla article about responsive images.
      Pageimage::srcset()
      // The property, which uses the set rules in the module configuration $srcset = $image->srcset; // A method call, using a set rules string // Delimiting with a newline (\n) would also work, but not as readable $srcset = $image->srcset("320, 480, 640x480 768w, 1240, 2048 2x"); // The same as above but using an indexed/sequential array $srcset = $image->srcset([ "320", "480", "640x480 768w", "1240", "2048 2x", ]); // The same as above but using an associative array // No rule checking is performed $srcset = $image->srcset([ "320w" => [320], "480w" => [480], "768w" => [640, 480], "1240w" => [1240], "2x" => [2048], ]); // Use the default set rules with portrait images generated for mobile/tablet devices $srcset = $image->srcset(true); // Return the srcset using all arguments $srcset = $image->srcset("320, 480, 640x480 768w, 1240, 2048 2x", [ "portrait" => "320, 640", ]); // The set rules above are a demonstration, not a recommendation! Image variations are only created for set rules which require a smaller image than the Pageimage itself. On large sites this may still result in a lot of images being generated. If you have limited storage, please use this module wisely.
      Portrait Mode
      In many situations, the ratio of the image does not need to change at different screen sizes. However, images that cover the entire viewport are an exception to this and are often the ones that benefit most from srcset implementation.
      The main problem with cover images is that they need to display landscape on desktop devices and portrait when this orientation is used on mobile and tablet devices.
      You can automatically generate portrait images by enabling portrait mode. It is recommended that you use this in combination with Pageimage::focus() so that the portrait variations retain the correct subject.
      The generated variations are HiDPI/Retina versions. Their height is determined by the portrait ratio (e.g. 9:16). Variations are always generated, regardless of whether the original image is smaller. Upscaling is disabled though, so you may find that some variations are actually smaller than they say they are in their filename.
      The sizes attribute should be used when portrait mode is enabled. Pageimage::sizes will return (orientation: portrait) and (max-width: {maxWidth}px) 50vw by default, which handles the use of these images for retina devices. The maximum width used in this rule is the largest set width.
      Pageimage::sizes()
      There is no option to configure default sizes because in most cases 100vw is all you need, and you do not need to output this anyway as it is inferred when using the srcset attribute. You can use the method for custom sizes though:
      // The property $sizes = $image->sizes; // Returns 100vw in most cases // Returns '(orientation: portrait) and (max-width: {maxWidth}px)50vw' if portrait mode enabled // A method call, using a mixture of integer widths and media query rules // Integer widths are treated as a min-width media query rule $sizes = $image->sizes([ 480 => 50, "(orientation: portrait) and (max-width: 640px)" => 100, 960 => 25, ]); // (min-width: 480px) 50vw, (orientation: portrait) and (max-width: 640px) 100vw, (min-width: 960px) 25vw // Determine widths by UIkit 'child-width' classes $sizes = $image->sizes([ "uk-child-width-1-2@s", "uk-child-width-1-3@l", ]); // (min-width: 640px) 50vw, (min-width: 1200px) 33.33vw // Determine widths by UIkit 'width' classes $sizes = $image->sizes([ "uk-width-1-2@m", "uk-width-1-3@xl", ]); // (min-width: 960px) 50vw, (min-width: 1600px) 33.33vw // Return the portrait size rule $sizes = $image->sizes(true); // (orientation: portrait) and (max-width: {maxWidth}px) 50vw // The arguments above are a demonstration, not a recommendation! Pageimage::render()
      This module extends the options available to this method with:
      srcset: When the module is installed, this will always be added, unless set to false. Any values in the formats described above can be passed. sizes: Only used if specified. Any values in the formats described above can be passed. uk-img: If passed, as either true or as a valid uk-img value, then this attribute will be added. The srcset attribute will also become data-srcset. Please refer to the API Reference for more information about this method.
      // Render an image using the default set rules echo $image->render(); // <img src='image.jpg' alt='' srcset='{default set rules}'> // Render an image using custom set rules echo $image->render(["srcset" => "480, 1240x640"]); // <img src='image.jpg' alt='' srcset='image.480x0-srcset.jpg 480w, image.1240x640-srcset.jpg 1240w'> // Render an image using custom set rules and sizes // Also use the `markup` argument echo $image->render("<img class='image' src='{url}' alt='Image'>", [ "srcset" => "480, 1240", "sizes" => [1240 => 50], ]); // <img class='image' src='image.jpg' alt='Image' srcset='image.480x0-srcset.jpg 480w, image.1240x640-srcset.jpg 1240w' sizes='(min-width: 1240px) 50vw'> // Render an image using custom set rules and sizes // Enable uk-img echo $image->render([ "srcset" => "480, 1240", "sizes" => ["uk-child-width-1-2@m"], "uk-img" => true, ]); // <img src='image.jpg' alt='' data-uk-img data-srcset='image.480x0-srcset.jpg 480w, image.1240x640-srcset.jpg 1240w' sizes='(min-width: 960px) 50vw'> // Render an image using portrait mode // Default rule sets used: 320, 640, 768, 1024, 1366, 1600 // Portrait widths used: 320, 640, 768 // Original image is 1000px wide // Not possible to use portrait mode and custom sets or portrait widths in render() // Sizes attribute automatically added echo $image->render(["srcset" => true]); // <img src='image.jpg' alt='' srcset='image.320x569-srcset-hidpi.jpg 320w, image.640x1138-srcset-hidpi.jpg 640w, image.768x1365-srcset-hidpi.jpg 768w, image.jpg 1024w' sizes='(orientation: portrait) and (max-width: 768px) 50vw'> Configuration
      To configure this module, go to Modules > Configure > PageimageSrcset.
      Set Rules
      These are the default set rules that will be used when none are specified, e.g. when calling the property: $image->srcset.
      Each set rule should be entered on a new line, in the format {width}x{height} {inherentwidth}w|{resolution}x.
      Not all arguments are required - you will probably find that specifying the width is sufficient for most cases. Here's a few examples of valid set rules and the sets they generate:
      Set Rule Set Generated Arguments Used 320 image.320x0-srcset.jpg 320w {width} 480x540 image.480x540-srcset.jpg 480w {width}x{height} 640x480 768w image.640x480-srcset.jpg 768w {width}x{height} {inherentwidth}w 2048 2x image.2048x0-srcset.jpg 2x {width} {resolution}x How you configure your rules is dependent on the needs of the site you are developing; there are no prescriptive rules that will meet the needs of most situations. This article gives a good overview of some of the things to consider.
      When you save your rules, a preview of the sets generated and an equivalent method call will be displayed to the right. Invalid rules will not be used, and you will be notified of this.
      Portrait Mode
      Set Widths
      A comma limited list of widths to create HiDPI/Retina portrait variations for.
      Crop Ratio
      The portrait ratio that should be used to crop the image. The default of 9:16 should be fine for most circumstances as this is the standard portrait ratio of most devices. However, you can specify something different if you want. If you add a landscape ratio, it will be switched to portrait when used.
      Any crops in the set rules ({width}x{height}) are ignored for portrait mode variations as this ratio is used instead.
      UIkit Widths
      If your website theme uses UIkit, you can pass an array of UIkit width classes to Pageimage::sizes to be converted to sizes. The values stored here are used to do this. If you have customised the breakpoints on your theme, you should also customise them here.
      Please note that only 1- widths are evaluated by Pageimage::sizes, e.g. uk-width-2-3 will not work.
      Remove Variations
      If checked, the image variations generated by this module are cleared on Submit. On large sites, this may take a while. It makes sense to run this after you have made changes to the set rules.
      Image Suffix
      You will see this field when Remove Variations is checked. The value is appended to the name of the images generated by this module and is used to identify variations. You should not encounter any issues with the default suffix, but if you find that it conflicts with any other functionality on your site, you can set a custom suffix instead.
      Debug Mode
      When this is enabled, a range of information is logged to pageimage-srcset.
      PageimageSrcsetDebug.js is also added to the <head> of your HTML pages. This will console.log a range of information about the images and nodes using srcset on your page after a window.onresize event is triggered. This can assist you in debugging your implementation.
      The browser will always use the highest resolution image it has loaded or has cached. You may need to disable browser caching to determine whether your set rules are working, and it makes sense to work from a small screen size and up. If you do it the other way, the browser is going to continue to use the higher resolution image it loaded first.
      UIkit Features
      This module implements some additional features that are tailored towards UIkit being used as the front-end theme framework, but this is not required to use the module.
      Installation
      Download the zip file at Github or clone the repo into your site/modules directory. If you downloaded the zip file, extract it in your sites/modules directory. In your admin, go to Modules > Refresh, then Modules > New, then click on the Install button for this module. ProcessWire >= 3.0.123 is required to use this module.
×
×
  • Create New...