Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Archive for March, 2019

Create .zip files with JavaScript dynamically

Saturday, March 23rd, 2019 by Servage
The JavaScript library JSZip provides you with the ability to generate .zip files dynamically. This way you can send lots of data to a user in a convenient and bandwidth-saving way. With JavaScript becoming more and more powerful, and the amount of data handled by JavaScripts increasing every day, this is a great way to communicate with the user. Most users generally accept zip files from trusted sites - assuming that your users trust your site ;-) It's really easy to create a .zip file. Check out this sample code: var zip = new JSZip(); zip.add("Hello.txt", "Hello World\n"); img = zip.folder("images"); img.add("smile.gif", imgData, {base64: true}); content = zip.generate(); location.href="data:application/zip;base64,"+content; Creating zip files in the browser with JavaScript also ...

Running terminal commands with PHP

Friday, March 15th, 2019 by Servage
terminalSometimes you may find yourself in a situation where you want to run more than just PHP code. Perhaps PHP does not have a built-in function for what you want to do or you want to run some custom commands, such as executing an external program. There are multiple ways to achieve this, and we will learn how to do it in two different ways. The usual way: exec() and shell_exec() These two functions are likely the ones that come to your mind first when thinking about a way to execute a terminal command. Both of there are basic PHP functions, and they are very similar to each other. The biggest difference between ...

How to build a successful site for e-commerce

Saturday, March 9th, 2019 by Servage
webshopE-commerce is quickly turning into a must-have for modern businesses. And why shouldn’t it when it’s relatively cheaper than selling products at a physical location, always having to worry about rent for your shop and a whole lot of others expenses. With an e-commerce business you can basically sell anything, no matter how big or small. And if you have good suppliers, you don’t even have to worry about having too many items in stock or running out of stock. With good managerial skills plus the right marketing and conversion funnel you can actually run a successful business where items sell themselves. Which other crucial element does your e-commerce business depend on, other than ...