forse è questo?
$img = imagecreatefrompng( "{$pathToImage}{$filename}" );