Uploaded image for project: 'In-Portal CMS'
  1. In-Portal CMS
  2. INP-1112

Pre-resize image to speed up page loading

    XMLWordPrintable

    Details

    • Additional information:
      Hide

      Also need to create "Settings" field (textarea) in each Agents/Scheduled Task. In context of this discussion this field can be used for specification of image resize settings described in original post.

      Show
      Also need to create "Settings" field (textarea) in each Agents/Scheduled Task. In context of this discussion this field can be used for specification of image resize settings described in original post.
    • Change Log Group:
      Added
    • Change Log Message:
      Adds image, used in theme, pre-resize ability to speed up page loading.
    • Story Points:
      1
    • External issue ID:
      1351
    • Copy Issue Key:
    • Patch Instructions:

      Patches must be submitted through Phabricator.

    • BC Break Details:
      Hide

      Reborn methods:

      • "kThemesHelper::getTemplateAliases" into "kThemesHelper::_getThemeSettings"

      Method signature changed:

      • "kScheduledTaskManager::update" - 1st parameter accepts scheduled task data array by reference instead of scheduled task name
      Show
      Reborn methods: "kThemesHelper::getTemplateAliases" into "kThemesHelper::_getThemeSettings" Method signature changed: "kScheduledTaskManager::update" - 1st parameter accepts scheduled task data array by reference instead of scheduled task name

      Description

      It's obvious, that users upload images in a higher resolution, then actually is needed on a website and they needs to be resized.

      Right now to speed up uploading process In-Portal don't resize image right after uploading, but only at time, when it's displayed in a different resolution on a website.
      This seems to be very good solution when:

      • small amount of users tries to view a page with image thumbnails displayed;
      • images were originally uploaded in low resolution (smaller then 1MB on size).

      But in case when a lot of users tries to see page with resized images at a same time and original images are ~4MB+ in size, then it will take a lot of memory and will attempt to resize same image multiple times.

      In-Portal don't pre-resize images in background, because it can't guess what image dimensions would be requested in actual theme, user set's as primary.

      But I have an idea, how to overcome that:

      Create new column in Theme table, called ImageResizeRules, where per-path image resize rules will be written in following format:

      • /system/path/one/:format1
      • /system/path/two/:format2

      Usually each line would look something like this:

      /system/images/manufacturers/:resize:100x75;default:img/no_picture.gif

      Actual data to place in ImageResizeRules field of the theme database table will be retrieved from <image_resize_rules> node in /_install/theme.xml file of individual theme.

      Then CRON script would scan all rules from each theme and pre-resize images according to them.

      Even more, if we would consider using Message Queuing servers, like ZeroMQ, then we could schedule resize jobs right after image was uploaded.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alex Alex
                Reporter:
                alex Alex
                Developer:
                Alex
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: