I tested the cropping widgets with several high definition wallpapers and cropping the wallpapers of dimensions above 5000px * 3000px crashed the browser. Now the multi-monitor wallpapers are expected to be of such high resolution, so my mentors & I decided to do the actual cropping on server side. I have implemented cropping on the server-side such that the dimensions of all the overlays are sent to server-side via
POST request by AJAX. In response, the server sends the gzipped tarfile of all the cropped segments. The cropped PIL/Pillow image objects couldn’t be saved as
TemporaryNamedFile, so following my mentor’s suggestion I have now used
tempfile.tempdir to save the cropped images & final gzipped tarfile, instead of setting a
TEMP_FOLDER in app configuration.
I implemented the delete overlay functionality by removing the DOM element & splicing the array of overlays’ jQuery objects, but a bug crept in. The overlay object which was shifted to the index of the object that was spliced doesn’t has its DOM element, so I changed its implementation to use different
ids for each overlay and use the jQuery object of specific
ids. It solved the problem, but then I realised I could just use the jQuery object of
overlay to maintain the collection of overlays’ DOM elements instead defining a new array.
Sirko Kemter suggested to ask user to input all the monitors’ resolution beforehand, so we can display only those wallpapers that can best fit all the monitors. So after discussing it with my mentor, we have planned to create a new download tab where user can enter dimensions of all their monitors and send it to server-side where a query is fired to display all the wallpapers larger than the size of rectangle enclosing the multi-monitor configuration. For this query, the resolution of the wallpaper will be added to the
Candidates table. After user selects the wallpaper, the wallpaper will be shown with the overlays of the monitors so the user can enlarge or move them apart & finally download the gzipped tarfile of cropped segments of wallpaper. This will make the “Add Screen” & the above mentioned delete overlay irrelevant.
Following the above discussion, several constraint are added to the overlays like minimum, maximum size & fixed aspect ratio. Moreover, the overlays now snaps to one another.
I also fixed several bugs reported by my mentor & discovered by me.