wordpress media full control over image uri/path

For a larger amount of images (approx 1k, plus same amount of thumbs, in ca 500 folders), we have the requirement that all image URIs used on the site have to have a SEO optimized path. They are already prepared and present with the complete path structures (each folder contains a thumbs folder with the same filename with smaller size/dimensions).

These are the URIs that we want to achieve:

Full size Image URI: http://myserver.com/img/de/cats/brown/jimmy.jpg

Thumb Image URI: http://myserver.com/img/de/cats/brown/thumbs/jimmy.jpg

  • They shall have an additional path, eg de/cats/brown in the examples above
  • They should start on the root of the domain, ie without the wp-content/uploads/ part of standard wordpress media files.
  • Simply put: we need full control over the image URIs, ie to have their own 'SEO-able' path structure and permalink.

    I checked out several Gallery plugins (paid and free) but could not find any documentation on them for the above requirement.

    Do you know of any plugin/theme to achieve and manage the URI structure described above?


    You can try to add these lines by placing them inside your functions.php file:

    update_option('upload_url_path', '/wp-content/uploads');
    

    This will make WordPress embed images like:

    src="/wp-content/uploads/fileName.jpg" 
    

    instead of

    src="http://domainName.com/wp-content/uploads/fileName.jpg"
    

    I hope this can help you to solve your problem.


    if you need to change default media upload location,you need to edit the wp-config.php file located in the root directory of your WordPress installation.

    define( 'UPLOADS', 'wp-content/'.'Your Folder Name' );
    

    Remember you can still choose whether or not you want uploaded files to be organized in month/year folders in Settings » Media.

    Note: Write this code before this line in wp-config.php

    require_once(ABSPATH . 'wp-settings.php');
    

    Hope it may help you

    链接地址: http://www.djcxy.com/p/29942.html

    上一篇: 使用React Native的Android库项目

    下一篇: wordpress媒体完全控制图片uri /路径