ryan Posted April 10, 2020 Share Posted April 10, 2020 Last week I posted in the blog about current projects in progress, and consistent with that, this week I’ve been working primarily on the upgrades to our file/image fields. To start, this focuses on storing additional info in the DB table, including file size, created/modified user info, and for image fields: width and height. This is useful in making these properties searchable from page-finding selectors, but also a necessary pre-requisite to supporting external file systems. A “ratio” floating point property is now available on image fields as well (and also stored in the DB) and this value reflects the width divided by the height. This is a searchable property and will be useful for quickly finding portrait images, landscape images, square images, or any proportion you need to find. If you want to find images that are at least twice as wide as they are tall, then you’d be looking for a “ratio” of 2.0 or larger (“ratio>=2”). If you needed to find perfectly square images (i.e. 300x300) then you’d be looking for a ratio of 1.0. If you needed to find portrait images, then you’d be looking for images with a ratio under 1.0 (or twice as tall as wide would be 0.5). You can figure out what ratio you are looking for just by taking your target width and dividing by your target height. Longer term, combined with the other added properties, the goal is that this will help with finding pages that have images suitable for specific placements, proportions and dimensions. These new properties won’t be useful at first on existing sites because the data just isn’t present in the DB, even if the columns to store them are. They are populated over time whenever the page is saved. But I’m going to enable an option to have it populate all of this automatically whenever the field is even loaded. It’s actually there in the core right now, but I’ve got it disabled so I can test it out on a few more of my installations before others start using it. There were some other upgrades to the core as well, including improvements to the Selector and Selectors classes, addition of a $database->columnExists() method, lots of new (mostly internal) methods in FIeldtypeFile/FieldtypeImage, and some refactoring of the FieldtypeMulti class, among other minor updates. While there were a lot of changes and additions this week, it’s not stuff that you’ll likely be using right away, so I’m going to hold off on bumping the version till next week. Thanks for reading and have a great weekend! 20 1 Link to comment Share on other sites More sharing options...
bernhard Posted April 10, 2020 Share Posted April 10, 2020 Hi Ryan, as always great to hear about the progress ? 14 minutes ago, ryan said: This is useful in making these properties searchable from page-finding selectors, but also a necessary pre-requisite to supporting external file systems. I have no idea how that will work internally, but this sounds like it might be a good time to also think about having a setting for a custom storage path in core file fields. Maybe that will be possible anyhow by default (like providing an external file system driver that actually stores files on the local file system). But if not this would be a huge improvement in many cases: File fields in module config File uploads with custom storage path in processModules Maybe having a file field on multiple pages sharing one single storage location (like a global gallery) Thx ? 8 Link to comment Share on other sites More sharing options...
teppo Posted April 10, 2020 Share Posted April 10, 2020 35 minutes ago, ryan said: Last week I posted in the blog about current projects in progress, and consistent with that, this week I’ve been working primarily on the upgrades to our file/image fields. To start, this focuses on storing additional info in the DB table, including file size, created/modified user info, and for image fields: width and height. This is useful in making these properties searchable from page-finding selectors, but also a necessary pre-requisite to supporting external file systems. Hey Ryan — just wanted to say thanks. Assuming that I've got this right and this could mean that eventually ProcessWire can natively (or at least with a module that doesn't have to rely on any weird tricks) support something like S3 or Google Cloud Storage, this is a brilliant move! Very much looking forward to that. Thanks again, and keep up the great work ? 10 Link to comment Share on other sites More sharing options...
bernhard Posted April 20, 2020 Share Posted April 20, 2020 Hey @ryan just posted a fix for an error that makes the new Image Fieldtype unusable with german locale setting due to an SQL error after image upload: https://github.com/processwire/processwire-issues/issues/1155 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now