2

BulletProof is a image-class function that basically makes it easier to upload image files securely. It puts in all security measures which makes it very amazing however there's one slight issue.

I need it to convert all files uploaded to JPEG, but I have no idea how.

public function convert($type) {

}

This is basically all I got, so in my PHP backend it should work like this.

$result = $bulletproof->fileTypes(array("jpeg", "png", "jpg"))
                ->uploadDir("../../data/avatars/")
                ->limitSize(array("min" => 1000, "max" => 300000))
                ->shrink(array("height" => 96, "width" => 96))
                ->upload($_FILES['image_file'], $filename)
                ->convert("jpeg");

Of course though, if there is an easier way I'm all ears!

Praveen Gowda I V
  • 9,569
  • 4
  • 41
  • 49
Cameron Swyft
  • 448
  • 2
  • 6
  • 21
  • 1
    You are right the class does not have that capility, but thanks to you, I will try to implement it as a feature in `v-2.0` comming soon. But you can can check http://stackoverflow.com/a/8550031/1640606 and http://php.net/manual/en/function.imagejpeg.php and you will see how it can be done. You must also use `covert()` before the upload, because the `upload()` method returns the image path, so it is not possible to method chain. I am in my phone, so I cann't give you much, but if you fail to find an answer let me know, I could try to help a little more. – samayo Mar 14 '15 at 13:17

0 Answers0