The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Picture Loader for HTML page

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #242645

    Hi, we have the need to load pictures in a place in our web page. Our web page is a CMS. It is not WordPress it is a custom made simple CMS specific to our needs. It is build in PHP. I want to know if anybody knows of a picture script, package, plugin that can load pictures in a size and auto crop aspect ratio. Also if you know what I should call this type of plugin. Thanks


    Is it just a display thing? In the sense that maybe a client is inserting images of all different sizes into their page via the CMS, possibly attempting to drag corners to visually resize, and the resulting jumble of sizes look messy and distorted? Is the goal to create a bit more uniformity?

    If so, this might help

    The idea is that it takes the src of an img tag (typically the way that images are inserted into a web page using a CMS WYSIWYG editor) and switches it to a background-image. At that point, ‘background-size:cover;’ kicks in for visual containment and faux-cropping.

    There is the ‘object-fit’ property that already achieves this in Chrome, Firefox, Opera, Safari and the likes, but IE and Edge don’t support it. My workaround linked above is kind-of a polyfill for that.

    I have it setup with TinyMCE as a custom styles selection on the WYSIWYG toolbar; The user embeds an image then can easily apply a class for either portrait or landscape proportions. It works pretty well :)


    Super… this is great info. It helps a lot. Thanks

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.