Home > Backend Development > PHP Tutorial > 关于php图片等比例缩放函数的.谁能帮我看看我这个函数怎么用啊?

关于php图片等比例缩放函数的.谁能帮我看看我这个函数怎么用啊?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:18:31
Original
1355 people have browsed it

<code>function resize($srcImage,$toFile,$maxWidth = 100,$maxHeight = 100,$imgQuality=100) 
{ 
   
    list($width, $height, $type, $attr) = getimagesize($srcImage); 
    if($width </code>
Copy after login
Copy after login

回复内容:

<code>function resize($srcImage,$toFile,$maxWidth = 100,$maxHeight = 100,$imgQuality=100) 
{ 
   
    list($width, $height, $type, $attr) = getimagesize($srcImage); 
    if($width </code>
Copy after login
Copy after login

因为tofile($srcImage,$toFile)第二个参数$toFile自己指定的话存在格式问题,比如srcImage是jpg,但是如果你填写的toFile是png,那格式就对不上了,因此如果你制定了toFile的文件后缀,那就直接干掉,然后在直接将原图片的格式追加在你指定的toFile后面。

--

简单来说:
tofile('a.jpg','b.png');
最终生成的是b.jpg而不是b.png

Related labels:
php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template