Open rotdrop opened 3 years ago
Hi,
It could be done, but it would be a kind of bad practice because the picture binary contents would be stored into the PHP memory until the final merging is done. That could be heavy when you have a big picture or several pictures.
In another hand, when files to be replaced or inserted in the template are designed by a path, then it is done on the fly (one by one) during the final merging.
And also, doing a temp file is very fast with PHP :
$temp_pic_ress = tmpfile();
fwrite($temp_pic_ress, $binary_contents);
$temp_pic_path = stream_get_meta_data($temp_pic_ress)['uri'];
Actually, I cannot quite follow you concerning the "bad practice", although I agree that it is only useful for comparatively small images, like a logo in the header of a letter, or the copy of a signature. It is clear that this can be handled with a temp-file, OTOH, OpenTBS then just reads the file into memory anyway (looking at _DatPrepare())?
I think I can come up with a pull request (here it is: #20)
Hi,
thank you for this nice package!
It would be nice to be able to insert picture (and maybe other file-data) from a PHP string instead of a file-name, as an additional option. Of course, one can always first copy the data to a temporary file on the server and then insert this file, but it would be convenient to be able to add the file-data directly without having to dump it to disk.