0
I’m making a script that reads an xml and then cuts its coordinates in the image and then saves it, but the "imagecrop" function always adds a black line at the end of the images and I just can’t change the size or delete the black line since almost all of them reach the edge. I’m using 2 codes, one generates the image and the other low.
crop2.php
$ini_filename = 'assets/sprites/achievements.png';
$im = imagecreatefrompng($ini_filename);
$xml = simplexml_load_file('assets/sprites/achievements.xml');
foreach ($xml->SubTexture as $sub) {
$to_crop_array = array('x' => $sub['x'] , 'y' => $sub['y'], 'width' => $sub['width'], 'height' => $sub['height']);
$thumb_im = imagecrop($im, $to_crop_array);
if ($_GET['name'] == $sub['name']) {
imagepng($thumb_im);
}
}
and Crop.php
<?php
ini_set('allow_url_fopen', TRUE);
$xml = simplexml_load_file('assets/sprites/achievements.xml');
foreach ($xml->SubTexture as $sub) {
file_put_contents('images/' . $sub['name'] . '.png', file_get_contents('http://localhost/apk/crop2?name=' . $sub['name']));
}
and I wanted to know how to remove this line without damaging anything.
There is a Bug #67447 reported recently on this subject.
– Zuul