Title: ripperdoc's Replies | WordPress.org

---

# ripperdoc

  [  ](https://wordpress.org/support/users/ripperdoc/)

 *   [Profile](https://wordpress.org/support/users/ripperdoc/)
 *   [Topics Started](https://wordpress.org/support/users/ripperdoc/topics/)
 *   [Replies Created](https://wordpress.org/support/users/ripperdoc/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/ripperdoc/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/ripperdoc/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/ripperdoc/engagements/)
 *   [Favorites](https://wordpress.org/support/users/ripperdoc/favorites/)

 Search replies:

## Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Cropping images and thumbnails in Media Library editor](https://wordpress.org/support/topic/cropping-images-and-thumbnails-in-media-library-editor/)
 *  Thread Starter [ripperdoc](https://wordpress.org/support/users/ripperdoc/)
 * (@ripperdoc)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/cropping-images-and-thumbnails-in-media-library-editor/#post-2242996)
 * Hi, I did a hack that solves the most urgent issue. The problem is that images
   changed by media library editor gets new filenames – any old references to the
   thumbnail will therefore point to the unedited version. This hack will rename
   the edited image to the original (overwriting it!). Only affects intermediate
   size, e.g. 150×150 thumbnails, at the moment.
 *     ```
       /**
        * Edited images using media library image editor gets new filenames, so
        * will not automatically be used by posts where they have already been inserted.
        * This filter detects those re-crops and changes the name back to the original
        * Caution: Will overwrite original thumbnail. Only affects "intermediate size".
        * By ripperdoc.net
        */
       function overwrite_recropped_thumbnail($resized_file) {
       	// Remove timestamp added to re-cropped images. TODO improve regex to avoid
       	// accidental path changes
       	$new_path = preg_replace( '/-e([0-9]+)-/', '-', $resized_file, -1, $count );
       	if($count>0) { // The file path had the timestamp, move back to original name
       		rename($resized_file, $new_path);
       		return $new_path;
       	} else { // do nothing
       		return $resized_file;
       	}
       }
       add_filter('image_make_intermediate_size', 'overwrite_recropped_thumbnail',10);
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [Permalinks not working in plugin code](https://wordpress.org/support/topic/permalinks-not-working-in-plugin-code/)
 *  Thread Starter [ripperdoc](https://wordpress.org/support/users/ripperdoc/)
 * (@ripperdoc)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/permalinks-not-working-in-plugin-code/#post-2219755)
 * Actually, found the issue: the plugin creates draft posts, and they are not given
   permalinks (although in the post editor, they are appearing with a permalink).
   Worth noting for others that if your plugin works with draft posts, permalink
   functions does not work.
 * I circumvented it with a filter that temporarily pretends a post is not in draft
   in order for it to get a permalink.

Viewing 2 replies - 1 through 2 (of 2 total)