Default* value for custom fileManager attribute
Permalink
Hey All,
I'm trying to give my client the ability to easily embed their images on other websites. Needless to say they are not incredibly tech savy. Basically all I need is a column on the fileManager called something like 'Embed Code'. Then I just need to show the file's url wrapped in [IMG][/IMG] tags.
The url is visible under properties and I've explained they can cut and paste that and simply add the tags in themselves. This did not go over well as clicking on properties takes too much time when dealing with many many images.
If someone could point me in the right direction for adding some code to the file uploads SQL that would be great. I've been digging through the file/php controller and model but am nervous about changing too much in there. Any suggestions as always are appreciated. Thanks,
Sax
I'm trying to give my client the ability to easily embed their images on other websites. Needless to say they are not incredibly tech savy. Basically all I need is a column on the fileManager called something like 'Embed Code'. Then I just need to show the file's url wrapped in [IMG][/IMG] tags.
The url is visible under properties and I've explained they can cut and paste that and simply add the tags in themselves. This did not go over well as clicking on properties takes too much time when dealing with many many images.
If someone could point me in the right direction for adding some code to the file uploads SQL that would be great. I've been digging through the file/php controller and model but am nervous about changing too much in there. Any suggestions as always are appreciated. Thanks,
Sax
Create a new file attribute (Dashboard -> File Manager -> Attributes), then click the orange box at the top-right of the file manager file list, and check the box next to that attribute -- it will now be displayed in the file manager along with the image thumbnail, name, creation date, etc.
Jordan's explanation for getting a custom file attribute to show up in the file manager is correct, but to automatically generate AND show the file's HTML <img> tag could be a bit more complex.
I haven't done something like that before, but I'd venture that you would have to overwrite some core files. You'd basically have to manually add your own column, get the file's info (if it's an image) and generate it's <img> tag yourself.
Now, you can make your own custom attributes (http://www.concrete5.org/documentation/how-tos/developers/custom-attribute-types) and maybe (not 100% sure) you could simply hard code the file's <img> HTML as its data (no user input). You'd still have to manually add that attribute to every current and subsequently-uploaded image file which may defeat the whole purpose of what you're trying to accomplish.
This is just my knee-jerk idea so I could be way off.
I haven't done something like that before, but I'd venture that you would have to overwrite some core files. You'd basically have to manually add your own column, get the file's info (if it's an image) and generate it's <img> tag yourself.
Now, you can make your own custom attributes (http://www.concrete5.org/documentation/how-tos/developers/custom-attribute-types) and maybe (not 100% sure) you could simply hard code the file's <img> HTML as its data (no user input). You'd still have to manually add that attribute to every current and subsequently-uploaded image file which may defeat the whole purpose of what you're trying to accomplish.
This is just my knee-jerk idea so I could be way off.