Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add an optional category to be inserted into the path #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rngadam
Copy link

@rngadam rngadam commented Oct 22, 2013

This lets us group attachments (for a particular customer or event).

Given this configuration:

ImageSchema.plugin(attachments, {
    directory: "/home/rngadam/letsface/src/prototype/public/images",
    storage : {
        providerName: 'localfs',
        options : {
          removePrefix: "/home/rngadam/letsface/src/prototype/public"  
        }        
    },
    properties: {
        image: {
            styles: {
                original: {
                    // keep the original file
                },
                thumb: {
                    thumbnail: '100x100^',
                    gravity: 'center',
                    extent: '100x100',
                    '$format': 'jpg'
                },
                detail: {
                    resize: '400x400>',
                    '$format': 'jpg'
                }
            }
        }
    }
});

output of image property is:

 image: 
   { detail: 
      { depth: 8,
        format: 'JPEG',
        oname: 'displayed.png',
        mtime: Tue Oct 22 2013 14:27:03 GMT+0800 (CST),
        ctime: Tue Oct 22 2013 14:27:03 GMT+0800 (CST),
        size: 15957,
        path: '/home/rngadam/letsface/src/prototype/public/images/zO0vt4yIo/detail/Sbz4kipeRM-detail.jpg',
        defaultUrl: '/images/zO0vt4yIo/detail/Sbz4kipeRM-detail.jpg',
        dims: [Object] },
     thumb: 
      { depth: 8,
        format: 'JPEG',
        oname: 'displayed.png',
        mtime: Tue Oct 22 2013 14:27:03 GMT+0800 (CST),
        ctime: Tue Oct 22 2013 14:27:03 GMT+0800 (CST),
        size: 2952,
        path: '/home/rngadam/letsface/src/prototype/public/images/zO0vt4yIo/thumb/Sbz4kipeRM-thumb.jpg',
        defaultUrl: '/images/zO0vt4yIo/thumb/Sbz4kipeRM-thumb.jpg',
        dims: [Object] },
     original: 
      { depth: 8,
        format: 'PNG',
        oname: 'displayed.png',
        mtime: Tue Oct 22 2013 14:27:01 GMT+0800 (CST),
        ctime: Tue Oct 22 2013 14:27:01 GMT+0800 (CST),
        size: 77825,
        path: '/home/rngadam/letsface/src/prototype/public/images/zO0vt4yIo/original/Sbz4kipeRM-original.png',
        defaultUrl: '/images/zO0vt4yIo/original/Sbz4kipeRM-original.png',
        dims: [Object] } },

@nuarhu
Copy link
Contributor

nuarhu commented Jan 14, 2014

Sorry for the late reply.

The change looks clean. Your example, however, does not show the usage of 'category'. I'm still not sure how it adds any value in addition to what is achieved by the keys like 'thumb', 'original', 'detail' etc. Is this really a commonly required use case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants