Skip to content

Image problem #10

Open
Open
@alexanderbuergin

Description

@alexanderbuergin

When I add an image to the generations process the vCard is generated as it should. But inside the code that is generated an error message from Craft CMS is added:

<pre>An Error occurred while handling another error:
yii\web\HeadersAlreadySentException: Headers already sent in /home/hicefuvo/www/spherene/sphereneV1/vendor/jeroendesloovere/vcard/src/VCard.php on line 623. in /home/hicefuvo/www/spherene/sphereneV1/vendor/yiisoft/yii2/web/Response.php:373
Stack trace:
#0 /home/hicefuvo/www/spherene/sphereneV1/vendor/yiisoft/yii2/web/Response.php(346): yii\web\Response-&gt;sendHeaders()
#1 /home/hicefuvo/www/spherene/sphereneV1/vendor/yiisoft/yii2/web/ErrorHandler.php(136): yii\web\Response-&gt;send()
#2 /home/hicefuvo/www/spherene/sphereneV1/vendor/craftcms/cms/src/web/ErrorHandler.php(192): yii\web\ErrorHandler-&gt;renderException(Object(yii\web\HeadersAlreadySentException))
#3 /home/hicefuvo/www/spherene/sphereneV1/vendor/yiisoft/yii2/base/ErrorHandler.php(135): craft\web\ErrorHandler-&gt;renderException(Object(yii\web\HeadersAlreadySentException))
#4 /home/hicefuvo/www/spherene/sphereneV1/vendor/craftcms/cms/src/web/ErrorHandler.php(71): yii\base\ErrorHandler-&gt;handleException(Object(yii\web\HeadersAlreadySentException))
#5 [internal function]: craft\web\ErrorHandler-&gt;handleException(Object(yii\web\HeadersAlreadySentException))
#6 {main}
Previous exception:
yii\web\HeadersAlreadySentException: Headers already sent in /home/hicefuvo/www/spherene/sphereneV1/vendor/jeroendesloovere/vcard/src/VCard.php on line 623. in /home/hicefuvo/www/spherene/sphereneV1/vendor/yiisoft/yii2/web/Response.php:373
Stack trace:
#0 /home/hicefuvo/www/spherene/sphereneV1/vendor/yiisoft/yii2/web/Response.php(346): yii\web\Response-&gt;sendHeaders()
#1 /home/hicefuvo/www/spherene/sphereneV1/vendor/yiisoft/yii2/base/Application.php(662): yii\web\Response-&gt;send()
#2 /home/hicefuvo/www/spherene/sphereneV1/vendor/nfourtythree/vcard/src/controllers/DefaultController.php(66): yii\base\Application-&gt;end()
#3 [internal function]: nfourtythree\vcard\controllers\DefaultController-&gt;actionIndex(&#039;-UVmaAHv4kdlP-C...&#039;)
#4 /home/hicefuvo/www/spherene/sphereneV1/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#5 /home/hicefuvo/www/spherene/sphereneV1/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction-&gt;runWithParams(Array)
#6 /home/hicefuvo/www/spherene/sphereneV1/vendor/yiisoft/yii2/base/Module.php(534): yii\base\Controller-&gt;runAction(&#039;index&#039;, Array)
#7 /home/hicefuvo/www/spherene/sphereneV1/vendor/craftcms/cms/src/web/Application.php(287): yii\base\Module-&gt;runAction(&#039;vcard/default/i...&#039;, Array)
#8 /home/hicefuvo/www/spherene/sphereneV1/vendor/craftcms/cms/src/web/Application.php(596): craft\web\Application-&gt;runAction(&#039;vcard/default/i...&#039;, Array)
#9 /home/hicefuvo/www/spherene/sphereneV1/vendor/craftcms/cms/src/web/Application.php(266): craft\web\Application-&gt;_processActionRequest(Object(craft\web\Request))
#10 /home/hicefuvo/www/spherene/sphereneV1/vendor/yiisoft/yii2/base/Application.php(392): craft\web\Application-&gt;handleRequest(Object(craft\web\Request))
#11 /home/hicefuvo/www/spherene/sphereneV1/web/index.php(21): yii\base\Application-&gt;run()
#12 {main}</pre>

Then I generate a new vCard without any image, I don't get an error.

This is my Code:

	{% set vcardTeam = siteUrl ~ craft.imager.transformImage(entry.portraitImage.one, { width: 250, height: 250, format: 'jpg' }) %}
	{% set vcardAddress = gloAddress.addressStreet ~ ' ' ~ gloAddress.addressNr %}
	{% set options = {
		photo: vcardTeam,
		firstName: entry.firstname,
		lastName: entry.lastname,
		prefix: entry.salutation,
		company: gloAddress.company,
		jobTitle: entry.jobFunction,
		url: gloAddress.website,
		email: [{ address: entry.eMail, type: "WORK" }, entry.eMail ],
		phoneNumber: [ entry.phone, { number: entry.phone }],
		address: [{
			name: gloAddress.company,
			street: vcardAddress,
			city: gloAddress.addressCity,
			zip: gloAddress.addressZip,
			country: 'Schweiz',
			type: "WORK;PARCEL;POSTAL"
		}],
	} %}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions