Image cropping

Issue #6 closed
Erin Bell created an issue

Looks like there are some issues with the image sizes. In particular, the image being saved is actually a cropped version instead of the fullsize original. I don't know much about how this works with ContentDM, so I'm assigning @ohiohistoryconnection. While you're in there, Phil, can you add a square thumbnail to the scaledlinks array in cdm-search-js.js?

Comments (7)

  1. Ohio History Connection repo owner

    I think the cropping issue is fixed now. As for a square thumbnail, for now I just allowed another loop in order to get a 128x128 thumbnail as scaledlink[4]. However, these sizes are arbitrary, so perhaps we might want to define optimal pixel dimensions for each desired size (thumbnail, modal display, saved image, etc.)? I could break out a separate 'getScaledLink()' function for that purpose.

  2. Erin Bell reporter

    Regarding square thumbnails, scaledlinks[4] is still, well, scaled. I was looking for an image with predictably square dimensions, but upon further reflection, I think I'd rather keep the original aspect ratio intact on the results list, even though uniform sizing might look nicer. The aspect ratio/dimensions are useful information for content creators, who (if they're anything like me) might have a general preference for landscape images. So we'll leave that as is, although by all means, create a simple helper function so we can just grab an image size like getScaledLink($longside=1080) or something to that effect.

  3. Ohio History Connection repo owner

    OK, just added a getScaledLink function based on image type desired ('thumb', 'modal', 'full'). If we want the flexibility of an arbitrary value as parameter, however, it can easily be changed to take that. On the question of a filled-in square thumbnail, the CDM image utilities unfortunately don't allow for that level of manipulation, but if we ever did want to have something like we might be able to style the thumbnail with margins and overflow:hidden to achieve the same basic effect.

  4. Erin Bell reporter

    It's likely due to the fact that I had to manually merge that commit since I had just finished some other stuff (and I apologize for a fairly messy commit just now as a result), but for whatever reason, I couldn't use your variables (i.e. fullScaledLink, etc). They were all returning the same image file but with different crop areas. I kept the function but undid it's uses. Do you want to look into that to see what's the matter?

  5. Ohio History Connection repo owner

    My bad - function wasn't actually working correctly. This should be fixed now however.

  6. Log in to comment