Home > Backend Development > PHP Tutorial > uploadify 上传图片,第一张正常,第二、三张错误

uploadify 上传图片,第一张正常,第二、三张错误

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:34:40
Original
993 people have browsed it

如题,如台头

但不是每个人都这样,我的本机测都正常,但是客户,第一张顺利上传,第二三张就失败,第四张就又顺利上传,这到底是怎么回事

我把$_FILES print_r 出来都正常,但是缩图的地方就第二三张就会错误,是那里错,请问各位大大。

<code>$src_x = imagesx($src);
$src_y = imagesy($src);
if($src_x > $src_y){
$s_thumb_x=250;
$s_thumb_y = intval($src_y / $src_x * 250);
$thumb_x = 600;
 $thumb_y = intval($src_y / $src_x * 600);
}else{
$s_thumb_y = 303;
$s_thumb_x = intval($src_x / $src_y * 303);
$thumb_y=904;
 $thumb_x = intval($src_x / $src_y * 904);
}
//第二三张时,这里会错误           
$thumb = imagecreatetruecolor($thumb_x, $thumb_y);
第二三张时,这里会错误
//$sthumb = imagecreatetruecolor($s_thumb_x, $s_thumb_y);
imagecopyresampled($thumb, $src, 0, 0, 0, 0, $thumb_x, $thumb_y, $src_x, $src_y);
// 第二三张时,这里会错误
imagecopyresampled($sthumb, $src, 0, 0, 0, 0, $s_thumb_x, $s_thumb_y, $src_x, $src_y);
imagejpeg($thumb, $ofile);
imagejpeg($sthumb, $sfile);
</code>
Copy after login
Copy after login

回复内容:

如题,如台头

但不是每个人都这样,我的本机测都正常,但是客户,第一张顺利上传,第二三张就失败,第四张就又顺利上传,这到底是怎么回事

我把$_FILES print_r 出来都正常,但是缩图的地方就第二三张就会错误,是那里错,请问各位大大。

<code>$src_x = imagesx($src);
$src_y = imagesy($src);
if($src_x > $src_y){
$s_thumb_x=250;
$s_thumb_y = intval($src_y / $src_x * 250);
$thumb_x = 600;
 $thumb_y = intval($src_y / $src_x * 600);
}else{
$s_thumb_y = 303;
$s_thumb_x = intval($src_x / $src_y * 303);
$thumb_y=904;
 $thumb_x = intval($src_x / $src_y * 904);
}
//第二三张时,这里会错误           
$thumb = imagecreatetruecolor($thumb_x, $thumb_y);
第二三张时,这里会错误
//$sthumb = imagecreatetruecolor($s_thumb_x, $s_thumb_y);
imagecopyresampled($thumb, $src, 0, 0, 0, 0, $thumb_x, $thumb_y, $src_x, $src_y);
// 第二三张时,这里会错误
imagecopyresampled($sthumb, $src, 0, 0, 0, 0, $s_thumb_x, $s_thumb_y, $src_x, $src_y);
imagejpeg($thumb, $ofile);
imagejpeg($sthumb, $sfile);
</code>
Copy after login
Copy after login

對不起各位大大,我找到錯誤的地方了.....

某一行的$src = @imagecreatefrompng($_FILES['Filedata']["tmp_name"]); 錯誤

Related labels:
php
source:php.cn
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