Skip to main content

Posts

PHP7 Compatibility Test in Windows / Wamp

Download php7cc.phar  from  https: //github .com /sstalle/php7cc/releases/download/1 .1.0 /php7cc .phar and save it in the root of wamp. (Where you keep all your projects) Then open the command prompt and proceed as given below. Replace the paths according to your system. You will find a detailed report in the specified report file.

GMail Rejecting IPv6 PTR

In case your postfix is not able to send mails to gmail accounts due to a IPv6 PTR failure, you are adviced to adhere to IPv4 in Postfix. edit  /etc/postfix/main.cf , and set  inet_protocols  to  ipv4 , inet_protocols = ipv4 You should restart postfix.

WhatsApp for Windows stuck in Fullscreen

In case your whatsapp for windows is stuck in fullscreen, close Whatsapp and open the following file. C:\Users\ username \AppData\Roaming\WhatsApp\settings.json where username is your login ID in windows. The file can be opened with Notepad or any text editor. Change "isFullScreen":true to "isFullScreen":false Save the file and start WhatsApp. Now you can change the size of the window. (If required, you can change the size of whatsapp window from the json file too.

Clearing image cache when updated with same name

When we update an image but the name remains the same, the browser keeps on showing the old image. This is very confusing for the admin and annoying too. If we use a decaching code, we end up reloading the image from the server on each visit and thus a lot of bandwidth is wasted. The best solution to this is to use a URL that changes when a image is updated. The best approach to achieve this is appending a dummy part to the image src that changes when the image is updated, and what could be better than the file timestamp !! So instead of <img src="image.jpg" width="200"> use <?php echo '<img src="image.jpg?m=' . filemtime ( 'image.jpg' ) . '" width="200">' ; ?>

Handling MISSING Image in HTML

It often happens that we allow users to upload a profile pic. But all the users do not upload a pic. Thus either we have to copy the same template image for all users or we get a broken image in the page. To fix this, use onerror code. Approach 1 - Hide the image if no image is available. onerror = " this . style . display = 'none' " Approach 2 - Use a template / filler image. onerror = " this . src = 'fallback-img.jpg' "