You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My uses cases required me to have more than one mongoose-field in my schema and I did that, applying the plugin in this way:
pageSchema.plugin(mongooseAttachments,{directory: 'images',storage: {providerName: 's3',options: {key: 'my aws key'secret: 'my aws secret'bucket: 'my aws bucket'}},properties: {design_background_image: {styles: {original: {//keep the original file},ipad_2_landscape: {resize: '1024x768>',blur: '3x3'},ipad_2_portrait: {resize: '768x1024>',blur: '3x3'}},design_banner_image: {styles: {original: {// keep the original file},ipad_2_landscape: {resize: '1024x768>'},ipad_2_portrait: {resize: '768x1024>'}}},avatar: {styles: {original: {// keep the original file}}}}});
The plugin works fine but I realized that if the two or more files to upload in two or more of the specified fields had the same extension then the files uploaded for each transformation were the same for all of them and it was one file between them.
After debugging to try to solve that issue and I could continue using this awesome module, I realized that the problem was (and is because I checked the code in the current file of the tag 0.0.4) in the line 170 of the file lib/attachments.js,
and it may fix it quite easy only using the original file name which is figured in the line 151 rather than the document id.
However to avoid to remove the file extension of the file name in each call to forEach function I declared a new variable after the line 160 and I used that variable in the line 170, so the result was something like:
// Below the line 160varfileNameNoExt=path.basename(attachmentInfo.name,fileExt);
........// line 170 replaced byvarstorageStylePath='/'+options.directory+'/'+fileNameNoExt+'-'+styleName+ext;
I solved my use case however I am calling 'attach' with and stand-alone rather than using express uploads, and although I think that it would also work well, I cannot be 100% sure, because I haven't tested it in that way.
Could you update the release of npm to carry on using the module from npm rather than use like a local library in my development?
Thanks so much.
The text was updated successfully, but these errors were encountered:
Sorry for the delay, @ifraixedes . Your pull request #26 cannot be merged automatically, anymore. Could you have a look at it after the release? Thanks!
Ok, no worries.
Although I thought that you should be able to merge my pull request if you create a new branch from tag 0.0.4 and after merge my pull request to that new branch, as I did to add the modification. I know that you move forward with the new release, however it may be good for people that it is using the old release so the branch may be updated to fix bugs rather than for new features or improvements.
Hello,
My uses cases required me to have more than one mongoose-field in my schema and I did that, applying the plugin in this way:
The plugin works fine but I realized that if the two or more files to upload in two or more of the specified fields had the same extension then the files uploaded for each transformation were the same for all of them and it was one file between them.
After debugging to try to solve that issue and I could continue using this awesome module, I realized that the problem was (and is because I checked the code in the current file of the tag 0.0.4) in the line 170 of the file lib/attachments.js,
and it may fix it quite easy only using the original file name which is figured in the line 151 rather than the document id.
However to avoid to remove the file extension of the file name in each call to forEach function I declared a new variable after the line 160 and I used that variable in the line 170, so the result was something like:
I solved my use case however I am calling 'attach' with and stand-alone rather than using express uploads, and although I think that it would also work well, I cannot be 100% sure, because I haven't tested it in that way.
Could you update the release of npm to carry on using the module from npm rather than use like a local library in my development?
Thanks so much.
The text was updated successfully, but these errors were encountered: