Skip to content

Commit

Permalink
Merge branch 'B-22779' of github.com:transcom/mymove into B-22779-exp
Browse files Browse the repository at this point in the history
  • Loading branch information
r-mettler committed Feb 28, 2025
2 parents feb055a + 219df09 commit 6307e65
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 63 deletions.
6 changes: 3 additions & 3 deletions pkg/paperwork/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ var contentTypeToImageType = map[string]string{
}

// ReduceUnusedSpace reduces unused space
func ReduceUnusedSpace(_ appcontext.AppContext, file afero.File, g *Generator, contentType string) (imgFile afero.File, width float64, height float64, err error) {
func ReduceUnusedSpace(_ appcontext.AppContext, file afero.File, g *Generator, contentType string, dirName string) (imgFile afero.File, width float64, height float64, err error) {
// Figure out if the image should be rotated by calculating height and width of image.
pic, _, decodeErr := image.Decode(file)
if decodeErr != nil {
Expand All @@ -500,7 +500,7 @@ func ReduceUnusedSpace(_ appcontext.AppContext, file afero.File, g *Generator, c

// If the image is landscape, then turn it to portrait orientation
if w > h {
newFile, newTemplateFileErr := g.newTempFile()
newFile, newTemplateFileErr := g.newTempFileInDir(dirName)
if newTemplateFileErr != nil {
return nil, 0.0, 0.0, errors.Wrap(newTemplateFileErr, "Creating temp file for image rotation")
}
Expand Down Expand Up @@ -611,7 +611,7 @@ func (g *Generator) PDFFromImages(appCtx appcontext.AppContext, images []inputFi
}
}

optimizedFile, w, h, rotateErr := ReduceUnusedSpace(appCtx, file, g, img.ContentType)
optimizedFile, w, h, rotateErr := ReduceUnusedSpace(appCtx, file, g, img.ContentType, dirName)
if rotateErr != nil {
return "", errors.Wrapf(rotateErr, "Rotating image if in landscape orientation")
}
Expand Down
49 changes: 37 additions & 12 deletions pkg/services/mocks/AOAPacketCreator.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

86 changes: 58 additions & 28 deletions pkg/services/mocks/PaymentPacketCreator.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 27 additions & 9 deletions pkg/services/mocks/PrimeDownloadMoveUploadPDFGenerator.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions pkg/services/mocks/SSWPPMGenerator.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions pkg/services/mocks/WeightTicketGenerator.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6307e65

Please sign in to comment.