Okay, for all nerds and computer programming enthusiasts, hence forth, I will be sharing with you my challenges day to day and what I did to resolve them! Happy coding
I've always loved how Whatsapp, Facebook, Twitter and all the major social network platforms maintained sanity of uploaded profile pictures through the use of instant resize at upload time. Of course not only profile pictures need to be made to conform to a specific dimension, if you find other scenarios during development when you need to ensure that your images are of a specific height and width, or aspect ratio then this article will help you do just that. You may also just want to give the user ability to resize before final upload, this article will help you do just that. Step 1: Download CropperJs Plugin There are lots of plugins that could help to achieve our objective, and I've tried a few. I find this one very robust and easier to use. Here's the github link Step 2: Import the CropperJs Plugin Using your script tag, import the downloaded plugin's Javascript file and link the CSS file too. Note, that for speedy loading, CSS files should be loaded in t...
Background: I use CorelDraw a lot to lay out my reports before writing the iTextSharp code to generate them. It gives me a fair idea of how to position report elements and keeps me from doing guesses or trial and error. This was the case when I worked on the ID Card project for Delta State University: I had the ID card neatly laid out and the school loved the design. Issue: Now, everyone knows we normally have long names in Nigeria. My design template had a name that was 10 characters long and I used 28pt points for this text. What I wanted to achieve however is that, for names that will not be able to fit into the maximum space allowed for the name text at the 28pt used in the design template, the system should use the maximum font size that will permit the name to fit in the space available. Its a simple problem, but wasn't so easy to resolve. Solution: public Font GetSafeFont ( string DisplayText, Font FontToUse, float SafeLength, float StartingSize) {...
Background: After surmounting my last challenge with dropzone.js and was able to upload my files. I was immediately faced with another one. The dropzone.js implementation apparently doesn't include any method for computing a value to send to the server while the file is being uploaded. What this means is that any headers or form data used to initialize the dropzone will be used repeatedly each time a file is uploaded. Issue: This meant that, for instance if I didn't want to upload a file using its name from the client, I may not be able to specify another name for the file as it is being uploaded. And that was exactly what I was faced with. Each time I created another record and uploaded a corresponding file with the dropzone, the file would overwrite my previous files, because I was apparently sending the same custom filename to the server to save my files with. My dropzone initialization code looked like this var mydropzone = $(targetelement).dropzone({ ...
Comments
Post a Comment