Can't Load Images from front end (please tell me if better forum to post) (1 post)

  1. silas.stewart
    Posted 2 years ago #

    I am trying to upload profiles from the front end of my website. All information is making it through okay to the custom profile post I have made in the back end except I can't get the image to store in the profile post. I am using inline upload plugin to upload image.

    Front End Code:

    update_post_meta($post_id, 'vsip_custom_image', $_POST['custom_image']);
    <?php echo do_shortcode("[inline_upload uploadpath='/uploads']"); ?>

    Back End Code: (in functions)

    //	Register the Service Manager
    function p_register() {
    //Arguments to create post type
    $args = array(
    'label'	 => __('Profiles'),
    'singular_label' => __('Profile'),
    'public'	 => true,
    'show_ui'	 => true,
    'capability_type'	=> 'post',
    'hierarchial'	 => true,
    'has_archive'	 => true,
    'supports'	 => array('title', 'editor', 'thumbnail'),
    'rewrite'	 => array('slug' => 'profile'),
    //'post_type'	 => 'profile'
    register_post_type('profile', $args);
    add_action('init', 'p_register');
    /*	---------------------------------------------------------------------	*
    *	Initialization
    *	---------------------------------------------------------------------	*/
    // Custom Meta Box
    add_action( 'add_meta_boxes', 'vsip_project_add_meta');
    // Save Meta Data
    add_action('save_post', 'vsip_post_save_data');
    /*	---------------------------------------------------------------------	*
    *	Custom Project Meta Box
    *	---------------------------------------------------------------------	*/
    // Field Array
    $prefix = 'vsip_';
    $vsip_post_meta_box = array(
    'id' => 'vsip-post-meta-box',
    'title' => __('Custom Meta', 'framework'),
    'page' => 'profile',
    'context' => 'normal',
    'priority' => 'high',
    'fields' => array(
    'label'	=> 'Image',
    'name'	=> 'Image',
    'id'	=> $prefix.'custom_image',
    'type'	=> 'image'
    // If Image
    case 'image':
    echo '<tr style="border-top:1px solid #eeeeee;">',
    '<th style="width:25%"><label for="', $field['id'], '">', $field['name'], '<span style=" display:block; color:#999; line-height: 20px; margin:5px 0 0 0;">'. $field['desc'].'</span></label></th>',
    $image = get_template_directory_uri().'/img/image.png';
    echo '<span class="custom_default_image" style="display:none">'.$image.'</span>';
    if ($meta) { $image = wp_get_attachment_image_src($meta, 'medium');	$image = $image[0]; }
    echo	'<input name="'.$field['id'].'" type="hidden" class="custom_upload_image" value="'.$meta.'" />
    <img src="'.$image.'" class="custom_preview_image" alt="" />
    <input class="custom_upload_image_button button" type="button" value="Choose Image" />
    <small> Remove Image</small>
    <br clear="all" /><span class="description">'.$field['desc'].'</span>';

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still - use a pastebin. As it stands, your posted code may now have been permanently damaged/corrupted by the forum's parser.]

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.