addField type image and thumbnail path

Posted by Christiaan on Stack Overflow See other posts from Stack Overflow or by Christiaan
Published on 2010-05-28T18:48:41Z Indexed on 2010/05/28 18:52 UTC
Read the original article Hit count: 210

Filed under:
|
|
|

Hello,

I have a Magento webshop and just created a custom module with the extension (Modulecreator). This module comes with a standard admin interface that can handle file uploads. I found out that if you want to show thumbnails you can use the 'image' field type (addField('myfield', 'image')) instead of the 'file' type field.

But now i've got a problem. When I upload files, I save them in a subdirectory called 'slides' in the 'media' directory. But when I edit the item, the image path for the thumbnail next to the uploadfield is set to the 'media' folder. Not my folder as I set it to 'media/slides/'.

I use the following code:

$fieldset->addField('filename', 'image', array(
        'label'     => Mage::helper('slideshow')->__('File'),
        'required'  => true,
        'name'      => 'filename',
        ));

I tried to set a 'path' key in the array, but this doesn't get picked up by Magento. Hate the lack of support for good and easy to use documentation by Magento...

Maybe you can help me out to find a solution?

© Stack Overflow or respective owner

Related posts about image

Related posts about path