$str = '
{
"base": {
"test1": "Главное",
"test2": "Столяры"
},
"home": "Главная"
}';
$name = 'data';
$data = json_decode($str, true);
file_put_contents($name . '.php', "<?php\n\n" . 'return ' . var_export($data, true) . ";\n");
$image = imagecreatefromstring(file_get_contents($img));
imagepng($image, '1.png');