I've created some functionality to manage email campaigns. I use summernote to edit the email templates.
Like most editors, Summernote stores images as base64 encoded image tags.
The issue that I have is when I want to send out the email, most mail clients don't render the base64 image tag. Therefore I'd need to use:
<img src="{{ $message->embed($pathToFile) }}"> or <img src="{{ $message->embedData($data, $name) }}">
According to the Laravel documentation:https://laravel.com/docs/5.7/mail#inline-attachments
The issue is that the mail class requires a set view
return $this->from('example#example.com')->view('emails.orders.shipped');
What is the best way to get the inline images from summernote into the email view? (Note that the email can contain multiple images and each template differs)
The current mail functionality basically expects your view to have the embed functions already in your view. But in this case, I need to dynamically set it.
The only thing that I got working was to isolate the images in the summernote value (data saved from textarea) and re-create them as images on disk. Then to generate a view dynamically with the image paths (embed($pathToFile) }}"> ) already written to the dynamic view. Then injecting that dynamic view into the email.
Related
Im trying to create a new outlook add-in that can extract the email content as html, and extracting the email content is working fine Office.context.mailbox.item.attachments
But my problem right is, If there an img tag include to the content. It will give me like this kind of img tag
<img class="x_w-1378 x_h-886" size="349452" data-outlook-trace="F:1|T:1" src="cid:9ea35d14-aa1e-47d6-9c5b-b31ced143981" style="max-width:100%">
<img width="643" height="359" id="x_Picture_x0020_1" src="cid:image001.png#01D8A327.B5A0B590" style="width:6.6979in; height:3.7395in">
I know there's an isInline properties and i can extract the base64 of the attachment.
Now question is, How would i know, if this img tag is for this attachment and vice versa? Like there's no indicator in img tag like this
<img id="AQMT12tasFGA....." src="cid:image001.png#01D8A327.B5A0B590" style="width:6.6979in; height:3.7395in">
Mime Content-Id header is used for In-line attachments, see https://www.ietf.org/rfc/rfc2392.txt for more information. Be aware, you can use EWS to get content ID values of attachments from Office web add-ins.
If you make a Gallery in Batflat CMS, the template tag it creates will generate its only Bootstrap HTML for a gallery. What if I just want to emit IMG tags for the gallery items, instead?
Create a Gallerymod custom module. That way, your customization may likely survive a Batflat Update.
Copy inc/modules/galleries as inc/modules/gallerymod.
Remove the lang folder and Admin.php in your gallerymod folder.
Change the Name and Description inside the gallerymod/Info.php, as well as the comments. I used static strings instead of code. Also in this file, inside the install function and uninstall function, remove code inside those so that it does nothing on install or uninstall.
In your gallerymod/Site.php, look for the $assign[$gallery['slug']] assignment, and on the following line, add:
$assign[$gallery['slug'] . '-alt1'] = $this->draw('gallery-alt1.html', ['gallery' => $tempAssign]);
Also, where you have the namespace line set as namespace Inc\Modules\Galleries;, change it to namespace Inc\Modules\Gallerymod;.
In your gallerymod/view folder, create a gallery-alt1.html file and add these contents:
{loop: $gallery.items}
<img class="photo-{if: $value.title}{$value.title}{/if}" alt="" class="img-responsive" src="{?=url($value.src.lg)?}">
{/loop}
Now activate this inactive module in Batflat's admin system. You'll notice that it has no admin panel -- because it doesn't need one. You already have the Galleries one. Do not deactivate the Galleries module because the Gallerymod module relies on the Galleries module.
Now, from your custom theme template, you can call this by varying how you called the old slug. So, if your old way of calling the gallery was something like {$gallery.home-photos}, then you would merely tack on the "-alt1" on the end and call it like {$gallery.home-photos-alt1}. I like to wrap these in a DIV wrapper with an ID on it so that I can address it with CSS, jQuery, or Javascript.
In the Batflat Admin system, go back and edit your image titles in the gallery. Treat those titles like a slug (lowercase alphanumeric phrase with dashes) because these are used as class names on the IMG tags in gallery-alt1.html, and you may want to address these individually in CSS, jQuery, or Javascript, later on.
Refresh your browser and you may see the source code display something similar to:
<div id="hidden-images" class="hidden">
<img class="photo-man2" alt="" class="img-responsive" src="https://example.com/uploads/galleries/2/15831273220.jpg">
<img class="photo-woman1" alt="" class="img-responsive" src="https://example.com/uploads/galleries/2/15831272980.jpg">
<img class="photo-man1" alt="" class="img-responsive" src="https://example.com/uploads/galleries/2/15831272540.jpg">
</div><!-- hidden-images -->
Just remember that if you update your version of Batflat, that you may need to reapply this customization again -- it depends on what was done in the update to the existing Galleries module.
If you have different tastes as to how you want to format your images, just edit your gallery-alt1.html file. Plus, you can make multiples of these for different situations, such as gallery-alt2.html, gallery-alt3.html, etc. You can even make it emit JSON instead of html so that you can insert it into a Javascript block in your theme.
Another tip for debugging, in case your site won't load or the admin system breaks, is to edit inc/core/defines.php and change the DEV_MODE to false. That way, PHP will show you every error and that might help you in debugging what might be wrong.
For the <title> I've followed this SO answer This is working perfectly for part but the image is not working
Laravel dynamic page title in navbar-brand
But, Here when I try to make an image dynamic instead of title it's giving me a text instead of an image.
For instance,
header.blade.php
#yield('image')
In another blade, I called image as in section
#section('image', '<img src="http://localhost/appname/public/front/images/heading.png">')
Every page has a dynamic logo so I want to put logo dynamic the same like we're doing in the title.
But the result I'm getting is
<img src="http://localhost/appname/public/front/images/heading.png">
You can do like this
#section('image')
<img src="http://localhost/appname/public/front/images/heading.png">
#endsection
I'm using Alex Michael's fantastic javascript filtrr library
to allow me to manipulate images on an HTML page. The question I have is how do I do an ajax/jquery post of an image that has been filtered inline on the page? For instance:
<div>
<img id="myimage" />
</div>
<input type="button" onclick="filterImage();" />
Once the filtering has been done, how do I post the contents of the image with id "myimage" back to a server-side PHP script so the filtered image can be saved? The tutorials I've seen for doing ajax image POSTs have all used file uploaders, which isn't what I'm looking for. I want to post an image from the HTML DOM.
Thanks!
Since the library you are using uses the Canvas element, the solution here should apply:
Uploading 'canvas' image data to the server
I/m having many img tag dynamically printed from facebook album pictures, like below-
echo '<'img src="' . $photo_detail['src_small'] . '" id="imageurl" onclick="return false" />';
I need is- When clicking on image the source of image is should set to- <'input type="hidden" id="imagesrc"/> value in the form
when submitting the form the value also submitted - like an image picker
To do what you need you will need to have an understanding of Javascript as well as Facebook's custom version of javascript called FBJS (if you are building an FBML canvas application).
If you do not yet have a strong understanding of how to do this outside of Facebook then I recommend reading through a good book on Javascript until you do.
Once you understand how to do this outside of Facebook the following wiki page should be a good guide on how you can use the same technique with FBJS: http://developers.facebook.com/docs/fbjs/