Skip to content

Commit 47d955c

Browse files
committed
Merge branch 'develop' into feature/resource
2 parents 1ede3b3 + 33835f1 commit 47d955c

3 files changed

Lines changed: 31 additions & 17 deletions

File tree

system/HTTP/Message.php

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -266,23 +266,16 @@ public function getHeaderLine(string $name): string
266266
*/
267267
public function setHeader(string $name, $value)
268268
{
269-
if (! isset($this->headers[$name]))
269+
$origName = $this->getHeaderName($name);
270+
271+
if (isset($this->headers[$origName]) && is_array($this->headers[$origName]))
270272
{
271-
$this->headers[$name] = new Header($name, $value);
272-
273-
$this->headerMap[strtolower($name)] = $name;
274-
275-
return $this;
276-
}
277-
278-
if (! is_array($this->headers[$name]))
279-
{
280-
$this->headers[$name] = [$this->headers[$name]];
273+
$this->appendHeader($origName, $value);
281274
}
282-
283-
if (isset($this->headers[$name]))
275+
else
284276
{
285-
$this->headers[$name] = new Header($name, $value);
277+
$this->headers[$origName] = new Header($origName, $value);
278+
$this->headerMap[strtolower($origName)] = $origName;
286279
}
287280

288281
return $this;

tests/system/HTTP/MessageTest.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,17 +181,25 @@ public function testAppendBody()
181181

182182
public function testSetHeaderReplacingHeader()
183183
{
184-
$this->message->setHeader('Accept', 'json');
184+
$this->message->setHeader('Accept', 'json');
185185

186-
$this->assertEquals('json', $this->message->getHeaderLine('Accept'));
186+
$this->assertEquals('json', $this->message->getHeaderLine('Accept'));
187187
}
188188

189189
public function testSetHeaderDuplicateSettings()
190190
{
191191
$this->message->setHeader('Accept', 'json');
192192
$this->message->setHeader('Accept', 'xml');
193193

194-
$this->assertEquals('xml', $this->message->getHeaderLine('Accept'));
194+
$this->assertEquals('xml', $this->message->getHeaderLine('Accept'));
195+
}
196+
197+
public function testSetHeaderDuplicateSettingsInsensitive()
198+
{
199+
$this->message->setHeader('Accept', 'json');
200+
$this->message->setHeader('accept', 'xml');
201+
202+
$this->assertEquals('xml', $this->message->getHeaderLine('Accept'));
195203
}
196204

197205
public function testSetHeaderArrayValues()

user_guide_src/source/libraries/images.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,19 @@ starting at the top left corner. The result would be saved as the thumbnail.
8989
while processing images you may need to limit their maximum size, and/or
9090
adjust PHP memory limits.
9191

92+
Image Quality
93+
=============
94+
95+
``save()`` can take an additional parameter ``$quality`` to alter the resulting image
96+
quality. Values range from 0 to 100 with 90 being the framework default. This parameter
97+
only applies to JPEG images and will be ignored otherwise::
98+
99+
$image = Config\Services::image()
100+
->withFile('/path/to/image/mypic.jpg')
101+
->save('/path/to/image/my_low_quality_pic.jpg', 10);
102+
103+
.. note:: Higher quality will result in larger file sizes. See also https://www.php.net/manual/en/function.imagejpeg.php
104+
92105
Processing Methods
93106
==================
94107

0 commit comments

Comments
 (0)