Plugin Directory

Changeset 2185958

Timestamp:
11/05/2019 07:05:23 AM (5 years ago)
Author:
shaharia.azam
Message:

Few bug fixed, new placeholder added and this plugin won't work for any other attachment type except image

Location:
auto-post-after-image-upload/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • auto-post-after-image-upload/trunk/auto_post_after_image_upload.php

    r2182821 r2185958  
    44Plugin URI:   http://wordpress.org/extend/plugins/auto-post-after-image-upload
    55Description:  This plugin will provide you the facility to create automated post when you will upload an image to your wordpress media gallery. Each time after uploading one media file upload one post will be created with attached this uploaded image automatically
    6 Version:      1.4
     6Version:      1.
    77Author:       Shaharia Azam <mail@shaharia.com>
    88Author URI:   http://www.shaharia.com?utm_source=auto-post-after-image-upload
  • auto-post-after-image-upload/trunk/lib/APAIU_Functions.php

    r2182821 r2185958  
    2626    public static function getAttachmentDetails($attachmentId){
    2727        $attachment = get_post( $attachmentId );
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
    2843        $finalData = [];
    2944        $finalData['attachment_id'] = intval($attachment->ID);
     
    4358        $largeImage      = wp_get_attachment_image_src( $attachmentId, 'large' );
    4459        $finalData['media_src_large'] = $largeImage[0];
    45         //$finalData['media_large_width'] = $largeImage[1];
    46         //$finalData['media_large_height'] = $largeImage[2];
    47 
    48         $imageThumb      = wp_get_attachment_image_src( $attachmentId, 'thumbnail' );
    49         $finalData['media_src_thumb'] = $imageThumb[0];
    50         //$finalData['media_thumb_width'] = $imageThumb[1];
    51         //$finalData['media_thumb_height'] = $imageThumb[2];
    52         return $finalData;
     60
     61        $imagePath = get_attached_file($attachmentId);
     62        $imageDimension = wp_get_image_editor($imagePath)->get_size();
     63        $finalData['media_large_width'] = isset($imageDimension['width']) ? $imageDimension['width'] : null;
     64        $finalData['media_large_height'] = isset($imageDimension['height']) ? $imageDimension['height'] : null;
     65
     66        return array_filter($finalData);
    5367    }
    5468
     
    5670        $preferences = unserialize(get_option("apaiu_prefs", ""));
    5771        $attachment = self::getAttachmentDetails($attachId);
     72
     73
     74
     75
    5876        $image_tag  = '<p><img src="' . $attachment['media_src_large'] . '" /></p>';
    5977
     
    124142        wp_enqueue_style( 'bootstrap.apaiu' );
    125143
    126         wp_register_style( 'sweetalert2.min', plugins_url( 'assets/css/sweetalert2.min.css', APAIU_FULL_FILE_PATH ), array( "bootstrap.apaiu" ), APAIP_VERSION );
    127         wp_enqueue_style( 'sweetalert2.min' );
     144        wp_register_style( 'sweetalert2.min', plugins_url( 'assets/css/sweetalert2.min.css', APAIU_FULL_FILE_PATH ), array( "bootstrap.apaiu" ), APAIP_VERSION );
     145        wp_enqueue_style( 'sweetalert2.min' );
    128146
    129147        wp_register_style( 'apaip.main', plugins_url( 'assets/css/main.css', APAIU_FULL_FILE_PATH ), array( "bootstrap.apaiu" ), APAIP_VERSION );
    130148        wp_enqueue_style( 'apaip.main' );
    131149
    132         wp_register_script( 'popperjs', plugins_url( 'assets/js/popper.min.js', APAIU_FULL_FILE_PATH ), array( 'jquery' ), APAIP_VERSION, true );
    133         wp_enqueue_script( "popperjs" );
    134 
    135         wp_register_script( 'bootstrap.min', plugins_url( 'assets/js/bootstrap.min.js', APAIU_FULL_FILE_PATH ), array( 'jquery' ), APAIP_VERSION, true );
    136         wp_enqueue_script( 'bootstrap.min' );
    137 
    138         wp_register_script( 'sweetalert2.min', plugins_url( 'assets/js/sweetalert2.min.js', APAIU_FULL_FILE_PATH ), array( 'bootstrap.min' ), APAIP_VERSION, true );
    139         wp_enqueue_script( 'sweetalert2.min' );
     150        wp_register_script( 'popperjs', plugins_url( 'assets/js/popper.min.js', APAIU_FULL_FILE_PATH ), array( 'jquery' ), APAIP_VERSION, true );
     151        wp_enqueue_script( "popperjs" );
     152
     153        wp_register_script( 'bootstrap.min', plugins_url( 'assets/js/bootstrap.min.js', APAIU_FULL_FILE_PATH ), array( 'jquery' ), APAIP_VERSION, true );
     154        wp_enqueue_script( 'bootstrap.min' );
     155
     156        wp_register_script( 'sweetalert2.min' ), APAIP_VERSION, true );
     157        wp_enqueue_script( 'sweetalert2.min' );
    140158
    141159        wp_register_script( 'apaip.main', plugins_url( 'assets/js/main.js', APAIU_FULL_FILE_PATH ), array(
    142             'bootstrap.min'
     160            'bootstrap.min'
    143161        ), APAIP_VERSION, true );
    144162        wp_enqueue_script( 'apaip.main' );
     
    175193        <section class="jumbotron text-center">
    176194            <div class="container-full">
    177                 <h1 class="jumbotron-heading">Auto1 Post After Image Upload</h1>
     195                <h1 class="jumbotron-heading">Auto Post After Image Upload</h1>
    178196                <p class="lead text-muted">
    179197                    Create post automatically after you upload any image in your media. It will definitely save lots of
     
    285303                    <div class="col-5">
    286304                        <h6>Available Placeholder</h6>
    287                         <pre>
    288                             <code style="font-size: 14px; line-height: 3;">
     305                        <pre><code style="font-size: 14px; line-height: 2;">
    289306{{user_name}}
    290307{user_display_name}}
     
    299316
    300317{{media_src_large}}
     318
     319
    301320
    302321{{media_src_thumb}}
    303 </code>
    304                         </pre>
     322</code></pre>
    305323                    </div>
    306324                </div>
  • auto-post-after-image-upload/trunk/readme.txt

    r2182821 r2185958  
    55Requires at least: 4.0
    66Tested up to: 5.3
    7 Stable tag: 1.4
     7Stable tag: 1.
    88Requires PHP: 5.5
    99License: GPLv2 or later
     
    4747== Changelog ==
    4848
     49
     50
     51
     52
     53
    4954= 1.4 =
    5055* Few minor bug fixed. Few buggy placeholder disabled that will be fixed in later updates
Note: See TracChangeset for help on using the changeset viewer.