PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.13.1
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.13.1
3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 2.8.17 2.8.18 All 259 releases
wpfunnels / vendor / intervention / image / src / Intervention / Image / Response.php

Response.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.13.1, at vendor/intervention/image/src/Intervention/Image/Response.php

79 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Intervention\Image;
4
5 use Illuminate\Support\Facades\Response as IlluminateResponse;
6 use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
7
8 class Response
9 {
10 /**
11 * Image that should be displayed by response
12 *
13 * @var Image
14 */
15 public $image;
16
17 /**
18 * Format of displayed image
19 *
20 * @var string
21 */
22 public $format;
23
24 /**
25 * Quality of displayed image
26 *
27 * @var int
28 */
29 public $quality;
30
31 /**
32 * Creates a new instance of response
33 *
34 * @param Image $image
35 * @param string $format
36 * @param int $quality
37 */
38 public function __construct(Image $image, $format = null, $quality = null)
39 {
40 $this->image = $image;
41 $this->format = $format ? $format : $image->mime;
42 $this->quality = $quality ? $quality : 90;
43 }
44
45 /**
46 * Builds response according to settings
47 *
48 * @return mixed
49 */
50 public function make()
51 {
52 $this->image->encode($this->format, $this->quality);
53 $data = $this->image->getEncoded();
54 $mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $data);
55 $length = strlen($data);
56
57 if (function_exists('app') && is_a($app = app(), 'Illuminate\Foundation\Application')) {
58
59 $response = IlluminateResponse::make($data);
60 $response->header('Content-Type', $mime);
61 $response->header('Content-Length', $length);
62
63 } elseif (class_exists('\Symfony\Component\HttpFoundation\Response')) {
64
65 $response = new SymfonyResponse($data);
66 $response->headers->set('Content-Type', $mime);
67 $response->headers->set('Content-Length', $length);
68
69 } else {
70
71 header('Content-Type: ' . $mime);
72 header('Content-Length: ' . $length);
73 $response = $data;
74 }
75
76 return $response;
77 }
78 }
79