开发者

match filename that starts with 900 x 500

I have this media picker from one of the CMS that we use and I want to restrict the image selected by the user. For the banners, the image should start with the name 900 x 500. I'm thinking if its possible regex to do this.

I try this to check if the filename starts with 900 but it doesn't work

/开发者_JAVA百科^900/


I think the following regex will do the trick:

^900(x|X)500.+

It will test that the name starts with 900x500, or 900X500, accepting afterwards any other characters. (At least one).


This may not be what you are after but is a solution none the less which may suit your needs.

an alternative to this would be to change the datatype of the field. There are some really good packages you could install which enable you to choose the size(dimensions) of the images a user picks and uploads.

you can view a demo here http://www.youtube.com/watch?v=cVVD60NHMRk

or you can view the package here http://our.umbraco.org/projects/backoffice-extensions/image-cropper

cheers. KJ

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜