gmail – Send email with a google doc as a pdf attachment Send email with an attachment located in Google Drive

Good day all. My google script worked fine until this week. I’m wanting to attached a google doc to an email as a PDF attachment. My code is as follows…

var pdf_attachment = DriveApp.getFileById(new_certificate_id).getAs("application/pdf");    
GmailApp.sendEmail(email_address, email_subject, email_body, {htmlBody: full_email_body, attachments: pdf_attachment});

Has anything changed with regard to how PDF attachments should be specified? Could this have anything to do with the securuty changes that were implemented this week? Many thanks…

hooks – (Drupal 8) How to alter view and add/change form action in Entity View Attachment (eva) with Table Format

I have 2 related content types (Order & Proposals). In Order Detail page, I attach the Proposals for that order using EVA with table format, like picture below.

enter image description here

I want to add an action button (vote) in EVA output (orange colored box buttons), so that when I click it, it update the Voted-field in the corresponding proposal node. But I don’t know where to start.

The problem is,

I’ve tried using hook_view_pre_render but I can’t find the corresponding object because somehow, Devel-DPM the view object is waaaaayy too large so the debugger gives error message and break my site. I noted the drupal_debug.txt for that particular view has more than 300.000 lines…

here is my alter code

function mymodule_views_pre_render(DrupalviewsViewExecutable $view) {
  if ($view->id() == 'order_proposal_list') {
    $results = $view->result;
    dpm($view); //this breaks my site...
    ddm($view); //this output in drupal_debug.txt with 300.000+++ lines....

Thanks for any helps.

Attachment list plus | NullScripts


Improves attachment list to show non-image attachments in a list.

(Example of attachment list plus)


Questions and answers:

Q: Will image attachments which are not embedded still show using the default XenForo attachment list?
A: Yes. Non-image attachments will be shown under the default XenForo attachments list.

.(tagsToTranslate)null scripts(t)nulled(t)nulled sites(t)nulled forum(t)nulled script(t)nulled scripts(t)nulled script forum(t)best nulled scripts site(t)xenforo nulled(t)xenforo 2 nulled(t)xenforo nulled themes(t)seo xenforo 2(t)xenforo themes(t)seo for xenforo(t)vbulletin nulled(t)vbulletin 5 nulled(t)whmcs nulled(t)hexa whmcs(t)whmcs addons nulled(t)whmcs templates nulled(t)whmcs template nulled(t)whmcs modules nulled(t)whmcs themes nulled(t)cs-cart nulled(t)xfilesharing pro nulled(t)blesta nulled(t)arrowchat nulled(t)multi vendor ecommerce script nulled(t)seo providers(t)adsense alternative

javascript – Trying to upload document in “Attachment” column of SharePoint list

Ok, first, as a side note, I see you are using


to build your REST API URLs. I would highly recommend switching to use


because siteAbsoluteUrl is going to give you the absolute URL of the root web in the Site Collection, so if you happen to be working in a sub-site within the site collection, you are not going to be getting the correct URL. webAbsoluteUrl will give you the correct URL for whatever sub-site you happen to be in.

Now, I see that you are constructing the correct URL to use to upload an attachment. If you have just created a new item there is a little shortcut you can take to get that URL, which I will show you.

The problem I’m seeing, though, is that to upload an attachment, you need to be sending an ArrayBuffer of the file as the data payload, not whatever object you are stringify-ing there in your second POST where you try to upload the attachment. On JavaScript File objects, there is a function arrayBuffer() you can call to get the ArrayBuffer to send.

So here’s how I would adjust your code:

// create the new item, but switch to webAbsoluteUrl
    url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('" + listName + "')/items",
    type: "POST",
    contentType: "application/json;odata=verbose",
    data: JSON.stringify(item),
    headers: {
        "Accept": "application/json;odata=verbose",
        "X-RequestDigest": $("#__REQUESTDIGEST").val()
    success: function (data) {
        // get the file
        var file = $("#txtfile").prop("files")(0);
        var uploadedFileName =;

        // you can construct the upload URL the way that you were, this is fine
        var itemId = data.d.Id;
        var uploadUrl = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('" + listName + "')/items(" + itemId + ")/AttachmentFiles/add(FileName='" + uploadedFileName + "')";

        // but, an alternate way to construct it would be
        var alternateUploadUrl = data.d.AttachmentFiles.__deferred.uri + "/add('" + uploadedFileName + "')";

        // now we need to get an array buffer of the file
        file.arrayBuffer().then(function (arrayBuffer) {
                url: uploadUrl,
                type: "POST",
                data: arrayBuffer,
                processData: false, // this is important to not have jQuery interfere
                headers: {
                    // when uploading attachments these are the 
                    // only two headers i have ever needed to include,
                    // and you probably want to remove the Content Type
                    // header because the content type you are sending
                    // is now an ArrayBuffer and not JSON
                    "Accept": "application/json;odata=verbose",
                    "X-RequestDigest": $("#__REQUESTDIGEST").val()
                success: function (data) {
                    alert("Data Submitted Successfull");
                error: function (xhr, status, error) {
    error: function (data) {
        console.log("not submitted");

finder – add multiple attachment to mail using applescript

I am trying to write applescript that send email with multiple attachments from selection.

The one I am currently using is working when one item selected but not working when two or more items selected.

Here’s my code.

tell application "Finder"
    set theFile to selection as alias
    set fileName to name of theFile
    set newRefFile to POSIX path of theFile
end tell
set AppleScript's text item delimiters to {"_"}
--extract customer name to CnameNFD
set CnameNFD to first text item of fileName
-- prevent broken korean letter
set Cname to ¬
    do shell script "echo " & (CnameNFD as text) & "|iconv -f UTF-8-MAC -t UTF-8"
-- extract date taken using exiftool 
set cDate to ¬
    do shell script "/usr/local/bin/exiftool -d "%Y-%m-%d" -DateTimeOriginal " & (newRefFile) & ""
-- extract latter
set AppleScript's text item delimiters to {":"}
set cDate to last text item of cDate
-- resetting delimiters 
set AppleScript's text item delimiters to {""}
--make subject to "Hi + customername"
set theSubject to "Hi" & "(" & Cname & ")"
set theBody to "attachment:  " & fileName & "
date taken: " & cDate & "
BODY contents"
set {text returned:theAddress} to display dialog "write email address" default answer "" buttons {"Cancel", "Okay"} default button 2
if button returned of result = "Okay" then
    set theAttachment to theFile
    set theAccount to "account"
    tell application "Mail"
        set theNewMessage to make new outgoing message with properties {sender:theAccount, subject:theSubject, content:theBody & return & return, visible:true}
        set color of words of theNewMessage to {0, 0, 0}
        set color of characters of theNewMessage to {0, 0, 0}
        tell theNewMessage
            set visibile to true
            make new to recipient at end of to recipients with properties {address:theAddress}
                make new attachment with properties {file name:theAttachment} at after the last word of the last paragraph
                set message_attachment to 0
            on error errmess -- oops
                log errmess -- log the error
                set message_attachment to 1
            end try
            log "message_attachment = " & message_attachment
            delay 3
        end tell
    end tell
    if button returned of result = "Cancel" then
        display alert "User canceled the job"
    end if
end if

I think I need to use repeat function but I am totally lost..

If I add multiple files, the subject part “Cname” should be one or more.

Also, Body contents “fileName” should be one or more.

Ofcourse, the actually attachment, too..

Where should I begin??

filters – Support old attachment url scheme after migrating uploads

There is an active site where all attachments are stored in the root of the uploads directory. Many files dramatically affect the performance, so I decided to put them into subdirectories with the scheme: year/month/day according to post_date_gmt.

All went well, but there is a problem: there may be old links to the images on the Internet, and also, for SEO reasons, I want to maintain them for a while.
I wrote a small filter that determines the new path of the file by its name (since the images were in the same directory, uniqueness in subdirectories is guaranteed):

add_filter('request', function ( $request ) {
    $uri = $_SERVER('REQUEST_URI');
    $filename = basename(parse_url($uri)('path'));
    if ( empty( $filename ) || preg_match('//d{4}/d{2}/d{2}//', $uri)) {
    global $wpdb;
    $sql = $wpdb->prepare(
        'SELECT meta_value FROM wp_postmeta WHERE meta_key = "_wp_attached_file" AND meta_value LIKE %s;',
        '%' . $filename
    $result = $wpdb->get_results($sql);
    if ( ! empty( $result )) {
        $file_path = $result(0)->meta_value;
        $new_uri = str_replace($filename, $file_path, $uri);
        // header or wp_redirect
        header('Location: ' . $new_uri, true, 301);
}, 99, 1);

This code seems to work, but I notice problems in the admin panel (not all resources are loaded correctly). I suspect that my implementation is too naive, and I need to improve it.

Also uploads has been migrated to the AWS S3 and I use this plugin for it:

plugins – How to get all attachment image from post ?? WordPress

I just want to get all atachment image from post with Alt, description, title, size, resotution

and how to add DOWNLOAD button?

i want to create image downloading website on wordpress for example LINK

 <?php  $args = array(
            'post_parent'    => $post->ID,
            'post_type'      => 'attachment',
            'numberposts'    => -1, // show all
            'post_status'    => 'any',
            'post_mime_type' => 'image',
            'orderby'        => 'menu_order',
            'order'           => 'ASC'

$images = get_posts($args);
if($images) { ?>
<?php foreach($images as $image) { ?>
  <img src="<?php echo wp_get_attachment_url($image->ID); ?>" >

plugins – How to get all attachment image from post ?? WordPress

I just want to get all atachment image from post with Alt, description, title, size, resotution

and how to add DOWNLOAD button?

i want to create image downloading website on wordpress for example LINK

 <?php  $args = array(
            'post_parent'    => $post->ID,
            'post_type'      => 'attachment',
            'numberposts'    => -1, // show all
            'post_status'    => 'any',
            'post_mime_type' => 'image',
            'orderby'        => 'menu_order',
            'order'           => 'ASC'

$images = get_posts($args);
if($images) { ?>
<?php foreach($images as $image) { ?>
  <img src="<?php echo wp_get_attachment_url($image->ID); ?>" >

Use rich text editor in ‘Edit Media’, for attachment media description

I have the following in my functions.php:

add_filter( 'wp_editor_settings', function( $settings ){
  if( get_post_type() == 'attachment'){
    $settings = (
      'wpautop'       => true,
      'textarea_name' => 'content',
      'textarea_rows' => 10,
      'media_buttons' => false,
      'tinymce' => true,
    return $settings;

And this does add the visual tab when I go to edit media in the WordPress admin. However, once I save my changes, and then go back to edit media and save again, it converts all the html to encoded html entities.

For example,

<h2>Another H2</h2>


&lt;h2&gt;Another H2&lt;/h2&gt;

Which prints the html on the front end. So I must be missing some essential piece that preserves html. What to I need to add to be able to use the visual tab when editing media descriptions?

This post is almost a correct answer but it doesn’t account for this HTML issue.