我有几个问题,我一直在寻找答案。内存策略
1:Php内存分配。
如果我有一个1兆字节变量$img =file_get_contents('imageUrl');
和我的PHP内存分配是64兆,并有100人在同一时间访问脚本,就是要引起内存分配错误?
2:如何更好地保存网址中的图片? 我得到一个内存分配警告...
if ($fileName){
//check to make sure filename is not taken
if(!file_exists("img/".$fileName.$fileExt)){
$image = file_get_contents("someURL".$fileName.$fileExt);
//check to make sure the filesize is not rediculous 8 Megabytes.
if(strlen($image) < (8 * 1048576)){
if(file_put_contents("img/".$fileName.$fileExt, $image)){
usleep((0.25 * 1000000)); //rest 1/4 second
if(!image_resize("img/".$fileName.$fileExt, 202, 202, 1))die('no rezize');
//PRETEND THERE ARE CLOSING CURLY BRACES THANKS
只是复制它copy ['http://example.com/example.jpeg','/example/example.jpeg');' – 2012-10-22 23:31:06
我还需要做一个缩略图版本... – user1290323
复制第一个然后制作大拇指 – 2012-10-22 23:33:46