Django filer change unsorted uploads - django

I'm using django-filer now and by default, every image will be stored in "Unsorted Uploads". How can I change that folder? The question is similar to this Using django-filer, can I chose the folder that images go into, from 'Unsorted Uploads'.
But I want to know is there any better way to do this?

Related

How to programatically move/categorize django-filer files?

We use django-filer 0.9.8 for our image uploads. Now we'd like to programatically add some images to the catalog and move them to filter category.
I managed to get the creation and saving of a FilerImage working, but when I check the admin all the images end up in an 'uncategorised' folder in the file management overview.
So I guess I'll have to move the file (the virtual file) but I cannot find any documentation about it. I'd assume I could pass something when I create the image, or move it after saving.
Any ideas? I'm looking at the docs and the source code but I cannot find anything.
FilerImage is just a ForeignKey to File, when you create it you can create also a filer.models.foldermodels.Folder and specify where the File is created.

Display uploaded gpx points and lines on map

I want to create simple upload form on my django site where users could upload their gpx files but I want to give them possibility to preview their points and lines on map before they proceed with submiting it.
I have some basic knowledge of working with django forms but I'm not sure how to convert that gpx data and display it on map.
I hope you can tell me at least where to start because I'm completely out of ideas.
Thanks
Well, if you use Django then you could probably extend it with Geodjango which provides you easy and nice way to create geometry fields for your models (points,lines, poligons).
In case you decide to use Geodjango for this purpose then please check my blog post http://ipasic.com/article/uploading-parsing-and-saving-gpx-data-postgis-geodjango/
I've described there process of uploading,parsing and saving gpx file to spatial database (like Postgis).It could help you to get an idea.
I didn't describe how to display it on map but it shouldn't be problem. I would recommend you to use Leaflet or some other javascript mapping library for it.
However, that's to much for writing right now.
I hope that helps.

Sitecore place multiple images from library at once

Working on a project for a client. They have a PDF that has been broken into separate pages as images, and they want to have each of those images appear on a single page - at least 40 images for this one page alone.
So far, I've just been placing them individually. Each time you go to place an image using the rich editor, you start at the media root - and the way the media library has been structured, these images are buried very deep within subfolders. So it takes about 20 seconds of clicking, scrolling, and reading to find each image to place it.
These images are sequential and placed in order in the media library. Is there a way I can select a group of images and just drop them in? There are going to be literally hundreds of these, and it's a huge waste of my (and my client's) time placing images one-by-one.
Going along the lines of what TwentyGotoTen has said, I would:
Structure your images in the Media Library within folders (if you haven't already done so)
Create a sublayout/xsl rendering that contains a repeater to render the images
Add the control to the layout and set the DataSource of that control to the Media Folder
The code should then retrieve all child items from that folder and render as necessary.
You may need the use of the Sublayout Parameter Helper to access the datasource from ascx codebehind.
I'm assuming you just want the images to appear one after the other with nothing else inbetween. Rather than embedding images in rich-text perhaps you should consider creating a multilist field for the images in the template and create a rendering / sublayout to render them.
You can set a more suitable source for the multilist than the media root. This should make it a lot easier to select the images.
Mark van Aalst has created a custom image field that allows to do this a bit easier as well.
Have a read through this. This is also available on Sitecore's Marketplace: Multiple Images Selector
It will allow you to select your images through a multilist field, but it'll show the images as an image field with multiple images.
I think this is pretty much the solution TwentyGotoTen is talking about as well, but shows the thumbnail of the selected images as well.

Adding Template Select and Image upload to custom post in Wordpress

I have become a bit confused on the best way to move forward with something I'd like to achieve in Wordpress. My problem is partly workflow I think and knowing the correct way to do what I'd like to achieve but also there may be a few blanks on how to actually implement some of what I need to do. I have checked various online resources but they all are specific to what they are doing and I can't easily understand them to apply them in to the context of my own project, which is why I wanted to ask here. I'm sure my initial question will inevitably branch out to sub questions but here we go:
For my website I have created a custom post type called 'projects'. I have successfully set this up.
Then for each project I need to allow the following data to be entered:
Project Title
Project Description
Also post meta data that will display as a list on each project page (I'll need to display both the key and value on the page but only for those fields that contain data 'i.e. I don't want the list to show as Location: blank'):
Client Name:
Location:
Project Value:
Architect:
Engineer:
Site Area:
My main question is this, I need to show images for each project and allow the user to select a 'template' for each project post, this is because there are about 5 grid designs for layout of the images (1 main Image, 1 square image with two small images right side, 3 portrait image cols etc).
I thought the correct way would be to create a custom post type called projects, add write panels to allow easy input of data (I've yet to add image uploads as this will need to vary depending on the template selected and number of images required), at data input stage the user selects the preferred image layout/template and then uploads images for the containers that allow images (I’ll need to id each image upload to position it in the template with CSS, that was the plan).
Firstly, am I approaching this correctly? And secondly, how can I add functionality to the write panel I have created to allow users to a) select a 'Template' (bit like you can with pages but for my custom post type) and b) to add image upload fields which change depending on the template selected?
Finally, I would like to stay away from using plug-ins and try and achieve this myself through functions.php etc. This is to avoid problems later as plugins update or lose support etc.
Any help is appreciated, thank you.
This sort of question seems to come up a lot in regards to Wordpress (I answered essentially the same question the other day). I know you want to avoid plugins but this sounds like a job for Advanced Custom Fields.
You can create exactly the fields you need for your custom post type (including an image upload field), and then add them into the template the corresponds with your custom post type.
ACF does have a 'lite mode' which can be included directly in a theme. This way you needn't worry about updates nuking site functionality. Believe me you will save yourself a lot of time and energy this way.
It's admirable to try and do it with pure WP, but it's a maturing platform, it just doesn't lend itself to this sort of customization easily.

Where to store flat files in CakePHP?

I am building an application that allows a user to browse html templates. The html template will be displayed in a preview area (source code will be obfuscated), and although the template will contain inline CSS/JS, there will also be the odd linked image asset.
For this reason, I thought it might be best for me to just store them as a library of folders, and retrieve the flat file from my server for display, as opposed to storing the HTML in the database and having to organise the external assets too.
My question is: Where in the CakePHP directory structure, is the best home for these files? I'd rather keep them above the webroot, and I'm thinking View.
Any ideas? Thanks.
I would suggest that you keep all the out-of-cakephp-framework related files, stored under the webroot.
My suggestion is the following directory structure for saving the html template as well as the css and js related files.
/webroot/files/templates/<template-project-name>/<the-actual-file>.html
Any external css, would then be under
/webroot/css/templates/<template-project-name>/<the-actual-css>.css
And the JS libraries would be under
/webroot/js/templates/<template-project-name>/<the-actual-js>.js
Use a seperate layout file (call it preview_layout.ctp) which simply renders
the template file as it is.
Hope it helps
Why do you want to store them above the webroot, when they are publicly-viewable assets? My gut feeling is that they really belong in the webroot or in the database. I would pick one or the other.
If you must store them above the webroot, I guess the best thing might be to store them as elements.
app/View/Elements/your_templates/
And that way, you can load it into the preview area of your View using:
echo $this->element('your_templates/template');
Edit:
Honestly, the suggestion of elements is not what I would recommend, I'm just trying to offer you different suggestions. It would be terribly bad practice and I think it will be more messy and problematic than it's worth.
As for the image files, put them in the webroot, regardless of where you choose to store the HTML templates. You can't stop people downloading the images once they are viewing them in their browser anyway.