php - Images not showing on wordpress because of special characters mess -


my site infected malwares. after cleaned site, noticed of wordpress images not showing because of special character issue. example image name displayed on ftp

sandí-a-asd-123.jpg 

but if access url through path still not accessible

mysite/imagepath/sandÃ-a-asd-123.jpg 

it accessible through path

mysite/imagepath/sandÃ%c2%ada-asd-123.jpg 

now should here? should change images names in wordpress db or should change names through ftp?

thanks

this wordpress function works me: remove special characters pic name. hope helps :d

add code in functions.php

function sanitize_filename_on_upload($filename) { $ext = end(explode('.',$filename)); // replace weird characters $sanitized = preg_replace('/[^a-za-z0-9-_.]/','', substr($filename, 0, -(strlen($ext)+1))); // replace dots inside filename $sanitized = str_replace('.','-', $sanitized); return strtolower($sanitized.'.'.$ext); }  add_filter('sanitize_file_name', 'sanitize_filename_on_upload', 10); 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -