Get the width of an image using PHP

<?php
list($width) = getimagesize(“5118-4XAwWL._SL110_.jpg”);
echo “Image width: ” .$width;
?>

Advertisements

Best way to use PHP to encrypt and decrypt message.

< ?php

define('SALT', 'whateveryouwant');

function encrypt($text)
{
return trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, SALT, $text, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
}

function decrypt($text)
{
return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, SALT, base64_decode($text), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)));
}

$encryptedmessage = encrypt("your message here");
echo decrypt($encryptedmessage);

? >