Skip to content

Commit

Permalink
fixed too many pages, updated dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
mcpenguin committed Aug 10, 2022
1 parent 7cccdd8 commit 30e9023
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docker/production/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ WORKDIR /usr/app
COPY package.json yarn.lock ./
RUN yarn --frozen-lockfile
COPY . .
RUN apk add --update ghostscript
RUN apk add --update graphicsmagick
RUN yarn run ts:build

# Stage 2: Run in production env
Expand Down
2 changes: 2 additions & 0 deletions docker/staging/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ WORKDIR /usr/app
COPY package.json yarn.lock ./
RUN yarn --frozen-lockfile
COPY . .
RUN apk add --update ghostscript
RUN apk add --update graphicsmagick
RUN yarn run ts:build

# Stage 2: Run in staging env
Expand Down
3 changes: 3 additions & 0 deletions src/listeners/messageCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ const convertResumePdfsIntoImages = async (message: Message): Promise<Message<bo
// Get the size of the pdf
const pdfDocument = await PDFDocument.load(readFileSync('tmp/resume.pdf'));
const { width, height } = pdfDocument.getPage(0).getSize();
if (pdfDocument.getPageCount() > 10) {
return await message.channel.send('Resumes must be less than 10 pages.');
}

// Convert the resume pdf into image
const imgResponse = await convertPdfToPic('tmp/resume.pdf', 'resume', width * 2, height * 2);
Expand Down

0 comments on commit 30e9023

Please sign in to comment.