Skip to content

John Croucher

  • Home
  • About Me
  • Contact
  • LinkedIn
  • Computers
  • Projects

Tag: PHP

Don’t use getimagesize() – PHP
14 Jun
John Posted in Programming No comments

Don’t use getimagesize() – PHP

Over the years I have been involved in fixing numerous websites that are performing slow. The PHP execution time on some were insane, into the many minutes. Nearly every time it has been down to the getimagesize() function. This function is terribly slow and should only be used if absolutely necessary. One thing people seemRead more about Don’t use getimagesize() – PHP[…]

Phonegap/Cordova out of memory when taking photos
09 Oct
John Posted in Programming No comments

Phonegap/Cordova out of memory when taking photos

I was having an issue with phonegap where an application on a specific phone would randomly crash after selecting a photo for uploading. I installed ACRA ( http://acra.ch/ ) so the phone can send a dump when it crashes. This turned out to be quite useful. The dump contained this part of interest The phoneRead more about Phonegap/Cordova out of memory when taking photos[…]

Remove commas from within quotes in a CSV
30 Apr
John Posted in Programming No comments

Remove commas from within quotes in a CSV

A client has software which does not honour commas within quotes. So all commas within quotes need to be removed before the CSV export is sent to the client. This function would be called for each line in the csv. $csv_data is the CSV to be parsed $replace_char is what to replace the comma with.Read more about Remove commas from within quotes in a CSV[…]

Code Snippet: Photo Randomiser
09 Aug
John Posted in Computers No comments

Code Snippet: Photo Randomiser

This was something I quickly threw together to randomise a folder of photos. Basically you put all your photos in one folder, it then randomly copies them to an output folder with a new file name. This was used for randomising photos for a photo DVD at a party. Its fine for basic things. IfRead more about Code Snippet: Photo Randomiser[…]

Code Snippet: Misc array counting function
09 Aug
John Posted in Computers No comments

Code Snippet: Misc array counting function

A friend wanted some simple code to count the number of times each email address in a list used the same domain.

Code Snippet: Display PHP settings
09 Aug
John Posted in Computers No comments

Code Snippet: Display PHP settings

Code Snippet: Want to see all your PHP settings? Place the following code in an empty .php file on your server Be sure to not leave this on your server once you are done with it as it could show potential security holes.

Code Snippet: Make sure a url starts with http://
08 Aug
John Posted in Computers No comments

Code Snippet: Make sure a url starts with http://

if( strpos($url, ‘http://’) === false ) $url = ‘http://’ . $url; Or if you are a fan of single line functions $url = ( strpos($url, ‘http://’) === false ) ? ‘http://’ . $url : $url;

Blog Categories

  • Computers
  • General
  • Linux
  • Mac
  • Programming
  • Windows

RSS Fail Try Again

  • Cat Litter Cabinet – Ikea Hack
  • Animated Skull Candy Bowl – Repair
  • Yamaha RX-V675 Repair
  • Resistor Organiser
  • Cat Hacking – A needy cat
  • Bathroom renovation – The black bathroom.
  • Guitar Scratch Plate
  • Cat Hacking – Off My Furniture
  • Hot Water Fail
  • Plushy/Stuffed Toy Storage
Copyright 1997-2020 John Croucher

Secondary Menu

  • fa-envelope
Llorix One Lite powered by WordPress