logo
down
shadow

Magento Upload Image in system.xml is not display the correct path


Magento Upload Image in system.xml is not display the correct path

By : Tiago
Date : November 22 2020, 10:56 AM
like below fixes the issue I have created image field on admin. and I got a problem with upload_dir and base_url is not same as I set, here's my code: , in system.xml add following
code :
           <bankicon translate="label">
                <label>Bank Icon</label>
                <frontend_type>image</frontend_type>
                <backend_model>mymodule/system_config_backend_image_bankicon</backend_model>
                <base_url type="media" scope_info="1">theme/default</base_url>
                <sort_order>1</sort_order>
                <show_in_default>1</show_in_default>
                <show_in_website>1</show_in_website>
                <show_in_store>1</show_in_store>
                <comment>Allowed file types: ICO, PNG, GIF, JPEG, APNG, SVG. Not all browsers support all these formats!</comment>
            </bankicon>
 class ABC_Mymodule_Model_System_Config_Backend_Image_Bankicon extends Mage_Adminhtml_Model_System_Config_Backend_Image
 {
/**
 * The tail part of directory path for uploading
 *
 */
const UPLOAD_DIR = 'theme/default';

/**
 * Token for the root part of directory path for uploading
 *
 */
const UPLOAD_ROOT = 'media';

/**
 * Return path to directory for upload file
 *
 * @return string
 * @throw Mage_Core_Exception
 */
protected function _getUploadDir()
{
    $uploadDir = $this->_appendScopeInfo(self::UPLOAD_DIR);
    $uploadRoot = $this->_getUploadRoot(self::UPLOAD_ROOT);
    $uploadDir = $uploadRoot . '/' . $uploadDir;
    return $uploadDir;
}

/**
 * Makes a decision about whether to add info about the scope.
 *
 * @return boolean
 */
protected function _addWhetherScopeInfo()
{
    return true;
}

/**
 * Getter for allowed extensions of uploaded files.
 *
 * @return array
 */
protected function _getAllowedExtensions()
{
    return array('ico', 'png', 'gif', 'jpeg', 'apng', 'svg');
}

/**
 * Get real media dir path
 *
 * @param  $token
 * @return string
 */
protected function _getUploadRoot($token) {
    return Mage::getBaseDir($token);
}


Share : facebook icon twitter icon
ZF2 Image path after upload and display

ZF2 Image path after upload and display


By : kuangkuang
Date : March 29 2020, 07:55 AM
may help you . Assuming by 'display this image link' you mean show the image in HTML, it would be:
code :
<img src="/uploads/4f3c8338_54f0f253_070305-076_5321f51f96ff1_532866a55f4b6.jpg">
Django Admin: Determine correct image upload path

Django Admin: Determine correct image upload path


By : Ercan Bilgin
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further As suspected, this problem is about URLs in Django. The problem occurred because I declared the following urlpattern in an app urls.py:
code :
     url(r'', views.index, name='index'),
     url(r'^$', views.index, name='index'),
    if settings.DEBUG:
        urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) 
File upload - Node Js(Express) to React Js. How to get correct image path?

File upload - Node Js(Express) to React Js. How to get correct image path?


By : Julio N.
Date : March 29 2020, 07:55 AM
hope this fix your issue You should set static folder path in express configurations like below:
app.use(express.static('public'))
code :
http://localhost:3000/kitten.jpg
Wordpress image path is correct but image does not display on site

Wordpress image path is correct but image does not display on site


By : user2917207
Date : March 29 2020, 07:55 AM
it helps some times basedir is a server path, but baseurl is URL to upload directory.
Try this:
code :
$uploads = wp_upload_dir();
$path = $uploads['baseurl'] . '/12hours/';
date_default_timezone_set('Africa/Johannesburg');
$hour = date("H");
if ($hour == 10) {
    echo 'it is 10am <br>';
    echo '<img src="' . $path . '6-60.jpg" data-src="' . $path . '6-60.jpg" class="img-fluid lazy" alt="something" />';
}
Display image in system configuration in magento?

Display image in system configuration in magento?


By : ihsan
Date : March 29 2020, 07:55 AM
like below fixes the issue If I understand correctly you need select image in back-end in system.xml:
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org