I have image filename being returned from a MYSQL database:
1073-6431.jpg
I need to return
1073-6431.webp
to access the webp version of the file - there are two files with same name, different extensions.
Simple right? For some reason nothing works though!
I've tried to make an array:
$file_array = explode('.', $file_name);
echo $file_array[0].'.webp';
I've tried to use pathinfo:
$fileName = pathinfo($file_name )['filename'];
echo $fileName. '.webp';
All I get is '.webp'
BUT if I explicitly enter the $file_name value:
$file_name = '1073-6431.jpg';
IT WORKS FINE! It just doesn't like using the value directly from the database. The database value is text and not an integer. I even tried to convert the value to text just make sure. Does anyone have any idea what I might be doing wrong?