In new view I select an image which has already been stored in Active Storage (I’m selected from a drop down list of images), but I want to have it appear so I can draw a rectangle on it. The rectangle will be a portion of the image (“snippet”) which will be visible in the show view.
How do I show the just selected image in new? Is there a Rails solution? Stimulus seems like a possibility, but I haven’t used it. After reading an introductory tutorial on Stimulus, it may be easier to tackle it via JavaScript.
Other background:
Snippet will be show with <%= image_tag(@location.doc.image.variant(crop: '350x40+650+230')) %>
. I’m planning to get the crop info using OpenLayers Draw createBox and store the width-height-top-left-coordinates with the record.
The images are pages from City Directories from around 1900 (like phone books—or is everyone here too young to know what they look like) and the snippet will be one to around six entries, so a small portion of the whole page. Usually I use one entry from a page, but sometimes several scattered around the page. The full images are around 2000 x 3000 pixels and the snippet will be less than ¼ the overall width and around 1/50 the height.
I’m only marginally competent at all this. I’m learning as I go.
Thank you for any pointers.