I'm using the Image Workshop plugin with composer in codeigniter. http://phpimageworkshop.com/
I've created a helper and linked this to my controller. The helper creates an ID card and then shows it to the user. However when it tries to find the jpeg to watermark I get this error:
File "http://localhost/test_files/Codeigniter/assets/images/juniorLicenceFront.png" not exists.
If I visit that exact URL the image that I want to write over shows up.
use PHPImageWorkshop\ImageWorkshop;
function printLicence($licence_num, $first_name, $last_name, $club, $expiry) {
$licenceFront = "juniorLicenceFront.png";
$files = base_url();
$layer = ImageWorkshop::initFromPath($files.'assets/images/'.$licenceFront);
// This is the text layer
$licenceNumLayer = ImageWorkshop::initTextLayer($licence_num, $files.'assets/Futura-Md-BT-Bold.ttf', 55, '#ea1d25', 0);
$licenceNumLayer->rotate(90);
$nameLayer = ImageWorkshop::initTextLayer("{$first_name}{$last_name}", $files.'assets/arial.ttf', 27, '333333', 0);
$clubLayer = ImageWorkshop::initTextLayer($club, $files.'assets/arial.ttf', 27, '333333', 0);
$expiryLayer = ImageWorkshop::initTextLayer($expiry, $files.'assets/arial.ttf', 27, '333333', 0);
$layer->addLayerOnTop($licenceNumLayer, 40, 60, "RT");
$layer->addLayerOnTop($nameLayer, 200, 255, "LB");
$layer->addLayerOnTop($clubLayer, 200, 198, "LB");
$layer->addLayerOnTop($expiryLayer, 200, 142, "LB");
$image = $layer->getResult();
header('Content-type: image/png');
imagepng($image);
imagepng($image, "card.png");
exit;
}
?>
A solution would be greatly appreciated I've spent many hours on this.