I have this
$resizeObj -> saveImage('images/'.$pic, 90);
and I want to append random characters at the end of file name in order to prevent duplicate names using somethign like this:
function genRandomString() {
$length = 10;
$characters = ’0123456789abcdefghijklmnopqrstuvwxyz’;
$string = ”;
for ($p = 0; $p < $length; $p++) {
$string .= $characters[mt_rand(0, strlen($characters))];
}
return $string;
}
Whta is the best way to incorporate this into $resizeObj
You should not save random string. Just append a unique string (eg. uniqid()) when you present the image.