Changeset 789467
- Timestamp:
- 10/17/2013 07:42:54 PM (12 years ago)
- File:
-
- 1 edited
-
lips/branches/dev-0.8.10/lips.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lips/branches/dev-0.8.10/lips.php
r788909 r789467 1883 1883 $local_picture_copy = ""; 1884 1884 1885 // Don't download the profile picture when it is stored to WordPress already. 1885 1886 $current_picture = get_user_meta($this->current_user->ID, LIPS_USER_META_PICTURE, true); 1886 1887 $download_picture = empty($current_picture); … … 1916 1917 $path = $upload_details['basedir'] . '/lips/' . $dimensions . "_" . str_replace(" ", "-", trim($json['id'])) . "." . substr($mimetype, strpos($mimetype, "/") + 1); 1917 1918 @mkdir(dirname($path), 0, true); 1918 file_put_contents($path, file_get_contents($picture_url)); 1919 $picture_meta = array( 1920 "post_title" => sprintf("%s %s", $json["formattedName"], __("profile picture")), 1921 "post_content" => "", 1922 "post_status" => "private", 1923 "post_mime_type" => $mimetype, 1924 ); 1925 $this->current_picture_size = $sizes[$size_index]; 1926 $picture_id = wp_insert_attachment($picture_meta, $path); 1927 wp_update_attachment_metadata($picture_id, $path); 1928 $local_picture_copy[$this->current_picture_size] = wp_get_attachment_url($picture_id); 1919 $saved = @file_put_contents($path, file_get_contents($picture_url)); 1920 // The user may not have permission to store the file 1921 if (FALSE !== $saved) { 1922 $picture_meta = array( 1923 "post_title" => sprintf("%s %s", $json["formattedName"], __("profile picture")), 1924 "post_content" => "", 1925 "post_status" => "private", 1926 "post_mime_type" => $mimetype, 1927 ); 1928 $this->current_picture_size = $sizes[$size_index]; 1929 $picture_id = wp_insert_attachment($picture_meta, $path); 1930 wp_update_attachment_metadata($picture_id, $path); 1931 $local_picture_copy[$this->current_picture_size] = wp_get_attachment_url($picture_id); 1932 } 1929 1933 } 1930 1934 $size_index++;
Note: See TracChangeset
for help on using the changeset viewer.