FORMATIVE 8 Flashcards

(16 cards)

1
Q

How can you get the MIME type of an uploaded file?
Group of answer choices

$file->getMimeType();

$file->getType();

$file->getFileType();

$file->getMIME();

A

$file->getMimeType();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What method is used to retrieve a file from a form submission in CodeIgniter 4?
Group of answer choices

$this->request->getFile(‘userfile’);

$this->input->file(‘userfile’);

$this->upload->getFile(‘userfile’);

$this->file->get(‘userfile’);

A

$this->request->getFile(‘userfile’);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which method is used to get the size of an uploaded file?
Group of answer choices

$file->getSize();

$file->getSizeInBytes();

$file->getFileSize();

$file->size();

A

$file->getSize();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the default upload directory in CodeIgniter 4?
Group of answer choices

writable/uploads/

assets/uploads/

files/

public/uploads/

A

writable/uploads/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How can you retrieve all uploaded files in a single request?
Group of answer choices

$this->request->getFiles();

$this->request->getAllFiles();

$this->input->getFiles();

$this->request->files();

A

$this->request->getFiles();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you rotate an image in CodeIgniter 4?
Group of answer choices

rotate()

spin()

turn()

flip()

A

rotate()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which of the following methods is used to crop an image?
Group of answer choices

crop()

cut()

trim()

slice()

A

crop()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which method is used to save the manipulated image to a file?
Group of answer choices

save()

store()

write()

export()

A

save()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the default driver used by CodeIgniter 4 for image manipulation?
Group of answer choices

GD2

GD

ImageMagick

Imagick

A

GD2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you specify the quality of an image when saving it in CodeIgniter 4?
Group of answer choices

save(‘path/to/file’, 85)

setQuality(85)

quality(85)

setCompression(85)

A

save(‘path/to/file’, 85)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does the isValid() method return if the file is successfully uploaded?
Group of answer choices

True

False

Null

An error message

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How can you restrict the file types allowed for upload?
Group of answer choices

Using $this->validate([‘userfile’ => ‘uploaded[userfile]|mime_in[userfile,image/jpg,image/jpeg]’]);

Using $file->setAllowedTypes()

Using $file->restrictTypes()

Using $file->filterTypes()

A

Using $this->validate([‘userfile’ => ‘uploaded[userfile]|mime_in[userfile,image/jpg,image/jpeg]’]);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which method is used to open an image for manipulation?
Group of answer choices

withFile(‘path/to/image’)

loadImage(‘path/to/image’)

openImage(‘path/to/image’)

getImage(‘path/to/image’)

A

withFile(‘pate/to/image’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What method is used to resize an image in CodeIgniter 4?
Group of answer choices

resize()

scale()

changeSize()

alterSize()

A

resize()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do you maintain the aspect ratio when resizing an image in CodeIgniter 4?
Group of answer choices

It maintains aspect ratio by default

Use ratioResize()

Set keepAspectRatio to true

maintainRatio()

A

It maintains aspect ratio by default

How well did you know this?
1
Not at all
2
3
4
5
Perfectly