How to show image in table cell in mailer markdown using laravel 5.7?
I am using laravel 5.7 and developing a newsletter mailer template in blade where blog posts are shown in table. Please see the code:
Controller to render mailer template in browser:
$posts = [
[
'title' => 'Post with tags',
'slug' => 'post-with-tags',
'excerpt' => "Post's Short description here",
'featured_image' => "1545299956.png",
'campaign_source' => "campaign source",
'campaign_name' => "campaign name",
'campaign_medium' => "campaign medium",
'campaign_term' => "campaign term",
'campaign_content' => "capaign content",
],
[
'title' => 'Post with tags',
'slug' => 'post-with-tags',
'excerpt' => "Post's Short description",
'featured_image' => "1545299956.png",
'campaign_source' => "campaign source",
'campaign_name' => "campaign name",
'campaign_medium' => "campaign medium",
'campaign_term' => "campaign term",
'campaign_content' => "capaign content",
]
];
echo (new AppMailEmailNewsletterForBlogPosts("Mailer Short Description", $posts))->render();
EmailNewsletterForBlogPosts:
$email= $this->subject(config('app.name')." : Our newsletter")->markdown('emails.blog_post_newsletter')->with([
'shortDescription' => $this->shortDescription,
'posts' => $this->posts
]);
blog_post_newsletter.blade.php:
This is working
@component('mail::message')
#{{$shortDescription}}
@component('mail::table')
| Image | Title |
| ------------- |:-------------:|
@foreach($posts as $post)
|  | Right-Aligned |
@endforeach
@endcomponent
Thanks,<br>
Exchange Support
@endcomponent
but this is NOT working
@component('mail::message')
#{{$shortDescription}}
@component('mail::table')
| Image | Title |
| ------------- |:-------------:|
@foreach($posts as $post)
@php
$imagePath = asset('storage/blog_featured_images/');
$imagePath.=$post->featured_image;
@endphp
|  | Right-Aligned |
@endforeach
@endcomponent
Thanks,<br>
Exchange Support
@endcomponent
The problem I guess here is whenever I perform any php operations like concatenating an image name with path, It shows me null in browser.
Event I tried passing full image path in $posts array but still featured image is not displayed but browser returns null.
Please help me guide in this scenario.
php laravel markdown github-flavored-markdown
add a comment |
I am using laravel 5.7 and developing a newsletter mailer template in blade where blog posts are shown in table. Please see the code:
Controller to render mailer template in browser:
$posts = [
[
'title' => 'Post with tags',
'slug' => 'post-with-tags',
'excerpt' => "Post's Short description here",
'featured_image' => "1545299956.png",
'campaign_source' => "campaign source",
'campaign_name' => "campaign name",
'campaign_medium' => "campaign medium",
'campaign_term' => "campaign term",
'campaign_content' => "capaign content",
],
[
'title' => 'Post with tags',
'slug' => 'post-with-tags',
'excerpt' => "Post's Short description",
'featured_image' => "1545299956.png",
'campaign_source' => "campaign source",
'campaign_name' => "campaign name",
'campaign_medium' => "campaign medium",
'campaign_term' => "campaign term",
'campaign_content' => "capaign content",
]
];
echo (new AppMailEmailNewsletterForBlogPosts("Mailer Short Description", $posts))->render();
EmailNewsletterForBlogPosts:
$email= $this->subject(config('app.name')." : Our newsletter")->markdown('emails.blog_post_newsletter')->with([
'shortDescription' => $this->shortDescription,
'posts' => $this->posts
]);
blog_post_newsletter.blade.php:
This is working
@component('mail::message')
#{{$shortDescription}}
@component('mail::table')
| Image | Title |
| ------------- |:-------------:|
@foreach($posts as $post)
|  | Right-Aligned |
@endforeach
@endcomponent
Thanks,<br>
Exchange Support
@endcomponent
but this is NOT working
@component('mail::message')
#{{$shortDescription}}
@component('mail::table')
| Image | Title |
| ------------- |:-------------:|
@foreach($posts as $post)
@php
$imagePath = asset('storage/blog_featured_images/');
$imagePath.=$post->featured_image;
@endphp
|  | Right-Aligned |
@endforeach
@endcomponent
Thanks,<br>
Exchange Support
@endcomponent
The problem I guess here is whenever I perform any php operations like concatenating an image name with path, It shows me null in browser.
Event I tried passing full image path in $posts array but still featured image is not displayed but browser returns null.
Please help me guide in this scenario.
php laravel markdown github-flavored-markdown
add a comment |
I am using laravel 5.7 and developing a newsletter mailer template in blade where blog posts are shown in table. Please see the code:
Controller to render mailer template in browser:
$posts = [
[
'title' => 'Post with tags',
'slug' => 'post-with-tags',
'excerpt' => "Post's Short description here",
'featured_image' => "1545299956.png",
'campaign_source' => "campaign source",
'campaign_name' => "campaign name",
'campaign_medium' => "campaign medium",
'campaign_term' => "campaign term",
'campaign_content' => "capaign content",
],
[
'title' => 'Post with tags',
'slug' => 'post-with-tags',
'excerpt' => "Post's Short description",
'featured_image' => "1545299956.png",
'campaign_source' => "campaign source",
'campaign_name' => "campaign name",
'campaign_medium' => "campaign medium",
'campaign_term' => "campaign term",
'campaign_content' => "capaign content",
]
];
echo (new AppMailEmailNewsletterForBlogPosts("Mailer Short Description", $posts))->render();
EmailNewsletterForBlogPosts:
$email= $this->subject(config('app.name')." : Our newsletter")->markdown('emails.blog_post_newsletter')->with([
'shortDescription' => $this->shortDescription,
'posts' => $this->posts
]);
blog_post_newsletter.blade.php:
This is working
@component('mail::message')
#{{$shortDescription}}
@component('mail::table')
| Image | Title |
| ------------- |:-------------:|
@foreach($posts as $post)
|  | Right-Aligned |
@endforeach
@endcomponent
Thanks,<br>
Exchange Support
@endcomponent
but this is NOT working
@component('mail::message')
#{{$shortDescription}}
@component('mail::table')
| Image | Title |
| ------------- |:-------------:|
@foreach($posts as $post)
@php
$imagePath = asset('storage/blog_featured_images/');
$imagePath.=$post->featured_image;
@endphp
|  | Right-Aligned |
@endforeach
@endcomponent
Thanks,<br>
Exchange Support
@endcomponent
The problem I guess here is whenever I perform any php operations like concatenating an image name with path, It shows me null in browser.
Event I tried passing full image path in $posts array but still featured image is not displayed but browser returns null.
Please help me guide in this scenario.
php laravel markdown github-flavored-markdown
I am using laravel 5.7 and developing a newsletter mailer template in blade where blog posts are shown in table. Please see the code:
Controller to render mailer template in browser:
$posts = [
[
'title' => 'Post with tags',
'slug' => 'post-with-tags',
'excerpt' => "Post's Short description here",
'featured_image' => "1545299956.png",
'campaign_source' => "campaign source",
'campaign_name' => "campaign name",
'campaign_medium' => "campaign medium",
'campaign_term' => "campaign term",
'campaign_content' => "capaign content",
],
[
'title' => 'Post with tags',
'slug' => 'post-with-tags',
'excerpt' => "Post's Short description",
'featured_image' => "1545299956.png",
'campaign_source' => "campaign source",
'campaign_name' => "campaign name",
'campaign_medium' => "campaign medium",
'campaign_term' => "campaign term",
'campaign_content' => "capaign content",
]
];
echo (new AppMailEmailNewsletterForBlogPosts("Mailer Short Description", $posts))->render();
EmailNewsletterForBlogPosts:
$email= $this->subject(config('app.name')." : Our newsletter")->markdown('emails.blog_post_newsletter')->with([
'shortDescription' => $this->shortDescription,
'posts' => $this->posts
]);
blog_post_newsletter.blade.php:
This is working
@component('mail::message')
#{{$shortDescription}}
@component('mail::table')
| Image | Title |
| ------------- |:-------------:|
@foreach($posts as $post)
|  | Right-Aligned |
@endforeach
@endcomponent
Thanks,<br>
Exchange Support
@endcomponent
but this is NOT working
@component('mail::message')
#{{$shortDescription}}
@component('mail::table')
| Image | Title |
| ------------- |:-------------:|
@foreach($posts as $post)
@php
$imagePath = asset('storage/blog_featured_images/');
$imagePath.=$post->featured_image;
@endphp
|  | Right-Aligned |
@endforeach
@endcomponent
Thanks,<br>
Exchange Support
@endcomponent
The problem I guess here is whenever I perform any php operations like concatenating an image name with path, It shows me null in browser.
Event I tried passing full image path in $posts array but still featured image is not displayed but browser returns null.
Please help me guide in this scenario.
php laravel markdown github-flavored-markdown
php laravel markdown github-flavored-markdown
asked Dec 29 '18 at 5:46
Dinesh SutharDinesh Suthar
6510
6510
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
try below:
$imagePath = $message->embed(asset('storage/blog_featured_images/'.$post->featured_image));
Thanks but what is$messageover here ?
– Dinesh Suthar
Dec 29 '18 at 5:53
@DineshSuthar $message variable used for display image.
– Jinal Somaiya
Dec 29 '18 at 5:54
@DineshSuthar read laravel.com/docs/5.7/mail#inline-attachments
– Jinal Somaiya
Dec 29 '18 at 5:56
Nope. I tried this:| )}} "THIS IS NOT WORKING") | Right-Aligned |
– Dinesh Suthar
Dec 29 '18 at 6:04
@DineshSuthar try without markdown mail.
– Jinal Somaiya
Dec 29 '18 at 6:19
|
show 2 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53967038%2fhow-to-show-image-in-table-cell-in-mailer-markdown-using-laravel-5-7%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
try below:
$imagePath = $message->embed(asset('storage/blog_featured_images/'.$post->featured_image));
Thanks but what is$messageover here ?
– Dinesh Suthar
Dec 29 '18 at 5:53
@DineshSuthar $message variable used for display image.
– Jinal Somaiya
Dec 29 '18 at 5:54
@DineshSuthar read laravel.com/docs/5.7/mail#inline-attachments
– Jinal Somaiya
Dec 29 '18 at 5:56
Nope. I tried this:| )}} "THIS IS NOT WORKING") | Right-Aligned |
– Dinesh Suthar
Dec 29 '18 at 6:04
@DineshSuthar try without markdown mail.
– Jinal Somaiya
Dec 29 '18 at 6:19
|
show 2 more comments
try below:
$imagePath = $message->embed(asset('storage/blog_featured_images/'.$post->featured_image));
Thanks but what is$messageover here ?
– Dinesh Suthar
Dec 29 '18 at 5:53
@DineshSuthar $message variable used for display image.
– Jinal Somaiya
Dec 29 '18 at 5:54
@DineshSuthar read laravel.com/docs/5.7/mail#inline-attachments
– Jinal Somaiya
Dec 29 '18 at 5:56
Nope. I tried this:| )}} "THIS IS NOT WORKING") | Right-Aligned |
– Dinesh Suthar
Dec 29 '18 at 6:04
@DineshSuthar try without markdown mail.
– Jinal Somaiya
Dec 29 '18 at 6:19
|
show 2 more comments
try below:
$imagePath = $message->embed(asset('storage/blog_featured_images/'.$post->featured_image));
try below:
$imagePath = $message->embed(asset('storage/blog_featured_images/'.$post->featured_image));
answered Dec 29 '18 at 5:51
Jinal SomaiyaJinal Somaiya
693213
693213
Thanks but what is$messageover here ?
– Dinesh Suthar
Dec 29 '18 at 5:53
@DineshSuthar $message variable used for display image.
– Jinal Somaiya
Dec 29 '18 at 5:54
@DineshSuthar read laravel.com/docs/5.7/mail#inline-attachments
– Jinal Somaiya
Dec 29 '18 at 5:56
Nope. I tried this:| )}} "THIS IS NOT WORKING") | Right-Aligned |
– Dinesh Suthar
Dec 29 '18 at 6:04
@DineshSuthar try without markdown mail.
– Jinal Somaiya
Dec 29 '18 at 6:19
|
show 2 more comments
Thanks but what is$messageover here ?
– Dinesh Suthar
Dec 29 '18 at 5:53
@DineshSuthar $message variable used for display image.
– Jinal Somaiya
Dec 29 '18 at 5:54
@DineshSuthar read laravel.com/docs/5.7/mail#inline-attachments
– Jinal Somaiya
Dec 29 '18 at 5:56
Nope. I tried this:| )}} "THIS IS NOT WORKING") | Right-Aligned |
– Dinesh Suthar
Dec 29 '18 at 6:04
@DineshSuthar try without markdown mail.
– Jinal Somaiya
Dec 29 '18 at 6:19
Thanks but what is
$message over here ?– Dinesh Suthar
Dec 29 '18 at 5:53
Thanks but what is
$message over here ?– Dinesh Suthar
Dec 29 '18 at 5:53
@DineshSuthar $message variable used for display image.
– Jinal Somaiya
Dec 29 '18 at 5:54
@DineshSuthar $message variable used for display image.
– Jinal Somaiya
Dec 29 '18 at 5:54
@DineshSuthar read laravel.com/docs/5.7/mail#inline-attachments
– Jinal Somaiya
Dec 29 '18 at 5:56
@DineshSuthar read laravel.com/docs/5.7/mail#inline-attachments
– Jinal Somaiya
Dec 29 '18 at 5:56
Nope. I tried this:
| )}} "THIS IS NOT WORKING") | Right-Aligned |– Dinesh Suthar
Dec 29 '18 at 6:04
Nope. I tried this:
| )}} "THIS IS NOT WORKING") | Right-Aligned |– Dinesh Suthar
Dec 29 '18 at 6:04
@DineshSuthar try without markdown mail.
– Jinal Somaiya
Dec 29 '18 at 6:19
@DineshSuthar try without markdown mail.
– Jinal Somaiya
Dec 29 '18 at 6:19
|
show 2 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53967038%2fhow-to-show-image-in-table-cell-in-mailer-markdown-using-laravel-5-7%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown