open(LOCAL, ">$imgdir/$name") or print 'error';