• Resolved lagunawebdesign

    (@lagunawebdesign)


    File renaming error!

    With file names with chars like:
    SĹ‚uchacze-opowieĹ›ci-o-oĹ‚tarzu-papieskim-z-Zaspy-150×150.jpg
    or:
    SÄ™dziowie-rozdajÄ…-szarfy-mĹ‚odym-sportowcom-294×197.jpg

    with others chars and language special chars works great.

    Filenames are after folder/files moving from one hosting to the other.

    https://wordpress.org/plugins/media-rename/

Viewing 1 replies (of 1 total)
  • Thread Starter lagunawebdesign

    (@lagunawebdesign)

    I wrote own php script to change wrong coding/charset

    ...
    			foreach($files as $file){
    
    				$path_parts = pathinfo($file);
    
    				$file_replace = $path_parts['basename'];						
    
    				if(mb_detect_encoding($file_replace, mb_detect_order(), true) == 'UTF-8'){
    
    					$file_replace = iconv("UTF-8", "Windows-1250", $file_replace);
    
    					$new_name = $path_parts['dirname'].DS.$file_replace;
    
    					//rename($file, $new_name);
    					copy($file, $new_name);
    					unlink($file);
    
    				};
    
    //debug($file); debug($new_name); die();				
    
    			}// endforeach file
    ...

    It would be nice to have an option to change FILE NAME (if UTF8 – is special chars) to slug/url valid file name by ONE CLICK in WordPress panel.

Viewing 1 replies (of 1 total)
  • The topic ‘File renaming error!’ is closed to new replies.