Using the execlent library ImageProcessor is really easy. Thanks James
How do you prevent ImageProcessorModule from intercepting images from certain folder?
Say I have a folder named "DontResizeMe" - how make ImageProcessor ignore this folder?
I think there are a few ways to achieve this, depending on which part you want to avoid.
You could inherit the ImageProcessingModule, and make your own pre-checks to determine if the request should be processed by the base class.
You could use the OnValidatingRequest event, and cancel any requests in the folder you choose.
There is a config setting for InterceptAllRequests that will ignore any request without query string params.
You could make your own "noop" service, and configure that for the prefixes you want. See examples here: https://github.com/JimBobSquarePants/ImageProcessor/blob/2f2044da7bf7f3960928a7ea47f5540975946062/tests/ImageProcessor.TestWebsite/config/imageprocessor/security.config
Related
Assume that I have a directory for uploaded public files like images in /var/my-project/upload/public.
I want to download files in public directory with its name. For example if there is a file named product-image.png in public directory with uri /var/my-project/upload/public/product-image.png, access to this file with this url: http://mysite/public/product-image.png.
I know how to use a controller for this purpose, but I want to know is there a way to directly access these files without using a controller method?
The only acceptable way of doing it is with a ReSTful api. There are other methods such as ftp, but When you use ftp, Files can be added by anyone who knows how. With a ReST controller, you define what can be added beforehand. In fact, with a controller you define just about everything regarding that endpoint.
So the short answer is (especially if you are using Spring boot) use an API, lest you not regret it later.
When I was in College, our website had a built in "back door" to a certain endpoint via ftp. Some kids in one of my classes found out about that back door and let themselves inside. Needless to say' they didnt bother wiping their shoes on the mat on their way in.
The moral: Never assume that your resources aren't worth messing with. All you need to do is make it unsecure, and people will eventually mess with it.
Is there support for embedded arrays in form? Like list of emails or phone numbers (these entities do not exist as standalone resource so it is impossible to use Reference* fields/inputs). SelectArrayInput looks promising, but it needs to know in advance possible options which is not the case (maybe there is an easy way to modify it to accept any option after hiting an enter button?).
Not currently, you'll have to make a custom input. If you do, please make it an addon and we'll reference it in the documentation.
Also note that someone started an addon about this: https://github.com/marmelab/admin-on-rest/pull/697
Is there a way to see TeamCity configurations that override parameter defined in template?
I don't think so. What's worked for me in the past was to search through the project files on the filesystem. If you have many build configs, this will be faster than opening each of them in the GUI.
Search for something like this:
<param name="myParamInheritedFromTemplate" value="myOverrideValue" />
in <TeamCity data directory>/config/projects/**/*.xml. If it's absent in an XML file, that build config just inherits the value. If it's present, it overrides it.
It's hacky but it's quick.
There is a feature request https://youtrack.jetbrains.com/issue/TW-21212, please vote. Current workaround are to either search the raw XML files with the settings stored under TeamCity Data Directory on the server as #sferencik suggested, or use REST API to get settings of all the build configurations and search for the parameter there. Let me know if you need help on any of these.
I have two separate Laravel instances/sites running on a server and want to be able to generate a url to a named route on one from code within the other.
For example the following named route exists in the first instance:
Route::get('users/my_account', array('uses' => 'UsersController#myAccount', 'as' => 'my_account'))
In the second instance I want to generate a url to the route above. Can anyone think of a clean way to do this, without explicitly knowing the url (i.e. only knowing the name of the route 'my_account')?
Basically I want to expose the RouteCollection of one site to the other...
That's a pretty interesting question. There's no natively supported way of doing that and, from what I know, it won't ever.
You could try loading the routes file of the first application, parsing it's configurations (you will need that for reverse routing), construct a Router instance and use it, but I'm sure it won't be simple at all.
If you have a really, I mean really, good reason to use reverse routes, you can try building a small API on the first application. That API should receive the parameters necessary, those used in url($params), and return the full url (with domain and everything). Although, this will introduce some serious performance issues.
IMHO, stick to hard coded my_account, leave a comment on the first application route and/or controller explaining that it's used on another project and move on :)
I may call this a dirty trick. Supposing you have the following structure in your file system, where both paths are Laravel apps:
/path/to/apps/app1
/path/to/apps/app2
And you want to load the routes file from app1 into app2. You can do it as follow:
include "../app1/apps/routes.php";
$url = URL::route('register');
VoilĂ ! But, although it worked for me there are some points to consider.
Include that file, will surely overwrites your current route collection for that process.
If that last is true, then you can have problem generating other URLs, maybe in your views.
The domain name will be of the current Laravel instance. It means that your URLs generated into app2 will hold the domain name of app1. I believe this is not what you want. But you can always generate non-absolute URLs with URL::route('register', null, false).
I've searched around online but can't find what I'm after. Basically, during an install, we fire off a separate executable that basically brute forces a few folders to be read/write enabled for the user group "EVERYONE".
Now, the person that wrote this never took into consideration system language. I had a call with a customer in France that kept failing installation because "EVERYONE" isn't what we would expect.
I'm after an API call to Windows that would return a security group name which would be "safe" to use in a localized environment. Essentially I'm looking to safely edit this code so instead of hardcoding in "EVERYONE", we call a function instead.
The fundamental mistake here is not so much the use of EVERYONE, but rather that the code is using names at all. Instead of using names you should use the well-known SIDs. In your case you need S-1-1-0.