Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_handle_upload

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
1966
1967      // Set correct file permissions
1968      $stat = stat( dirname( $new_file ));
1969      $perms = $stat['mode'] & 0000666;
1970      @ chmod( $new_file, $perms );
1971
1972      // Compute the URL
1973      $url = $uploads['url'] . "/$filename";
1974
1975      $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
1976
1977      return $return;
1978 }
1979
1980 function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) {
1981      if ( $height <= $hmax && $width <= $wmax )
1982           return array( $width, $height);
1983      elseif ( $width / $height > $wmax / $hmax )
1984           return array( $wmax, (int) ($height / $width * $wmax ));