I’m terribly sorry if I’m missing something obvious, but when I use Image Processing I need to be able to control where the generated images get published to…right now they all end up in the root “publishdir” which is really not ideal for me, ideally I’d get them dropped in publishdir + some_prefix. Couldn’t find an answer in the docs and with quite a bit of Google-fu.
Thanks for anyone’s help in advance!
Resource.Copy might do what you want.
May I ask… why do you need to control their publishing directory ? Do you need their path, to mention the same resources in several templates ?
In that case, you should rather use .Scratch to store them, since Copy well, copies the images. The developpers still haven’t come up with a renaming procedure, for a reason that puzzles me.
I need control over their publishing directory for two primary reasons, first, because 1500+ random filenames generated in what is the site root is a pain for a number of (sub…) reasons, and second, more importantly for my uses, for cache control purposes at deployment. I don’t care if the generated output directory gets clogged up, but having tons of files in the root that don’t relate to the whole generated site, that I can’t really reliably pattern match except to glob all images into the same bucket.
Third very less important bit is for log analysis, but that’s a minor concern, more of a side-benefit.
Template re-use I’m not concerned about, and best I can tell in the handful of cases where that’s happening I’m ending up with one generated output file and not multiple (might be slightly accidental since they’d be all from the same shortcode with same ultimate image processing options).
.Scratch might lead me to something. I was really hoping there was some config I was missing to tell the image processing bits (or heck even all of that sort-of-related stuff like pipes) to output their results elsewhere. Because right now even … say like posts/blah/index.md pulling in it’s own resources from it’s own bundle winds up with a file written to “publishdir”/ directly (which is where most of this problem is created from).
Them ending up under public/ is strange in my opinion. This an excerpt of my asset directory:
│ ├── banners …
│ ├── banners_original …
│ ├── biology …
│ ├── history …
│ ├──🔗 Lain-Iwakura-Serial-Experiments-Lain-comic-freak-37540192
My public directory reflects the same organization. Simply put, whatever arborescence is in assets/ or static/, is copied under public/. the name will just change a bit (fingerprinting n all), but you said it wasn’t your concern.
├── Images …
│ ├── banners
│ ├── biology
│ │ ├── angola_fires.webp
│ ├── history
But that’s because I use global assets… not sure but page resources should be under the page you put them… Here under posts/blah/ next to index.html
That was the something obvious. Fresh eyes. I can easily just move all the offending assets in the assets subdir, and since there’s only three short codes that cause these resources to get pulled in I can have that do the fixup, and for the few that misses they can be identified easily. Honestly…had NOT occurred to me to approach it that way. Long term there’s a manual or manual+automation cleanup process that’s going to happen on the source for this mess.
Thank you for helping me to see the tree in the forest.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.