Comfortable mexican sofa - upload file to specific path - ruby

At this moment when I upload file into CMS it is being stored in location like:
/system/comfy/cms/files/files/000/000/004/original/logo.jpg
I would like to be able to specify that logo category files will be stored in path
/system/logo/logo.jpg
and files of category images in:
/system/images/image.jpg
Where should I start? Im pretty sure that this is impossible to achieve using only comfy GUI however I am quite not experienced in working with this cms, can anyone give me a hint how I can do that?

It's right that Paperclip handles that.
However you can set the upload path changing the value of config.upload_file_options entry in the /config/initializers/comfortable_mexican_sofa.rb file

Related

How to get full image paths from web page using Firebug?

I would like to download all images in full quality from this blog: http://w899c8kcu.homepage.t-online.de/Blog.
I have access to server, but I can not find the directory where the images lie. When I use Firebug on the first picture, it shows me http://w899c8kcu.homepage.t-online.de/Blog;session=f0577255d9df9185d3abe04af0ce922d&focus=CMTOI_de_dtag_hosting_hpcreator_widget_PictureGallery_15716702&path=image.action&frame=CMTOI_de_dtag_hosting_hpcreator_widget_PictureGallery_15716702?id=34877331&width=1000&height=2000&crop=false.
How can I find the file paths like /dirname/image.jpg?
According to its HTML output the page obviously uses the CM4all content management system (CMS).
I don't know how precisely this CMS is working, though generally CMSs normally either save the files under cryptic names within a folder specified in the CMS's configuration or not in the file system at all but within a database.
Also, CMS may only save compressed or resized versions of the original files.
So, if you don't want to or are not able to dig into the server-side script code to find out if and where the images are saved, you should contact the company behind CM4all about this.

Changing Where CKEditor Looks for Images

I am wondering if there is some way to change where CKEditor looks for images. Right now it uses the location of the web page containing the editor as the root directory but I would like to write a javascript function that can change this directory to any arbitrary path passed to the function.
The bigger picture for this is that I'd like to extend the functionality of CKEditor to be able to save the source it creates to whatever location is picked by the user. I've already implemented getting the source and saving it using wxWidgets but am having trouble getting CKEditor to change its working directory so that images can be included from the directory the user picks.
I've tried using some of the properties like baseDir, basePath, and baseHref to make this possible but as far as I can tell none of them quite do what I'm looking for.
So the process would be:
(1) The user picks a directory where the source will be saved
(2) The user creates a page using CKEditor where images from the directory chosen can be included AND DISPLAYED in CKEditor
(3) The user saves the source of their page to the chosen directory (the source saved here should use the relative path to the images because the source is now located in the same directory as the images it includes)
I realize this is a rather unconventional use of CKEditor but if someone might be able to kick me in the right direction to making this happen, I'd really appreciate it.
EDIT:
So after a little experimenting and changing some backslashes to regular slashes, it looks like the baseHref attribute does what I'd like. I've still not been able to change its value at runtime though as I would like. Does anybody know if this is possible with CKEditor? I'd still like to have a javascript function that I can pass a path to and have it change this baseHref value. Right now I have set its value in config.js.
If this isn't possible, I know you can read and write the source in and out of the editor. So I would like to resort to reading and storing the source from the editor, reloading CKEditor with a new config.baseHref, and then writing the source back into the editor. Does anyone know if the CKEditor api provides functionality to reload its configuration?
Thanks.
I don't expect too many people will be trying to do what I was doing here since CKEditor is usually hosted on a server somewhere, but in case someone finds it helpful, here's what I ended up doing.
As I mentioned in the edit to my question, modifying the baseHref gave me the functionality of prepending the image filename with the directory path leading to it. I wasn't able to find a way to modify it while the editor was running so I ended up telling CKEditor to load an external configuration file each time it started with the line
config.customConfig = 'C:/Users/kenwood/Desktop/MarkCreator2/ckeditor/custom_config.js';
Then I used C++ to write new contents to custom_config.js any time I wanted to switch directories.
Unfortunately this method meant I had to read the contents out of the editor, refresh the page, and then write the editor contents back in any time I wanted to change directories. This was adequate for what I needed though.

Image path in Magento keeps going to base folder

I'm trying to add an image on my CMS page by using something like {{skin url=images/foldername/image%2011.jpg}}
With this, I should get a path like 123abc/magento/skin/frontend/default/default/images/foldername/image%2011.jpg
But instead of that path, I get a path going to the base like so
123abc/magento/skin/frontend/base/default/images/foldername/image%2011.jpg
I'm 100% sure that the folder works because I have other images on the same folder that works in other pages. I didn't change the package name so I'm not sure why this is happening for some files. Based on what I found on the web, magento looks for the image at the base folder if it can't find the file on the specified path but the image is there. Does anybody know how to resolve this and what else could be causing this?
Solution by OP.
I noticed how I got this problem only with images with spaces on the filename hence the %20 on the file path. Though I was given literally hundreds of images with spaces on their filenames, the easiest and fastest way to resolve this is to remove the space for each of the image.

Not able to upload pictures with magmi.

I've recently moved my website to a new server (shared). I made a backup with installtron and put everything in place on the new server.
Every went pretty smooth, but i'm facing some difficulties with uploading my feeds via magmi. I'm getting errors when im using the image attribute processor. The following erros pop up:
download error,URL http://mydomain.com is unreachable.
The stupid thing is that the image link he's pointing to is working and points to the picture, but somehow it is not uploading it. This was working at my previous website. I'm pretty sure it has something to do with write permissions, but i can't figure out which one it is. Permissions are all set to 755 (shared hosting)
Anybody has any idea?
I found the error. It had something to do with the fact that i filled a path "Image search path" within the image attribute plugin. I thought that would not matter if i would point to an absolute path in my csv file, but apparently it did. After i removed the location there it did upload my pictures pointing to an absolute path.
Thanks all!

Can't download files from the downloadable products folder directly from the product page

I've created a few downloadable products and added an mp3 file as the product.
Now instead of going through the checkout to download the file i wanted the user to be able to do it on the products page in view.phtml by clicking on a link
The problem i have is that i can't seem to download files which are in this downloadable folder
media/downloadable/files/links/t/o/toast_to_the_dead_-_immortal_technique.mp3
If i move that track to media/filename.mp3 ..or even in the wysiwyg folder then i can download it using my script. I've checked the file permissions etc and they're fine so im stuck as to why i can't download my files.
Does anyone know? or is there a way i can change the folder from downloadable to something else, as all i need downloadable products for is music files.
Cheers
Edit:
I should also add that i am getting the download box to save the file, with the correct file name and path, its just the file is 523 bytes, im using the code below to get the filepath
$mediaUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
$_linkpath = $mediaUrl."downloadable/files/links".$_link->getLinkFile();
If i were to change the link path to $mediaUrl."filename.mp3" etc then it would download..so seems to me that its the downloadable folder thats causing the problem?
Nevermind I've solved this, I just changed $_linkpath to
$_linkpath = "media/downloadable/files/links".$_link->getLinkFile();
The full url was causing the problem

Resources