WordPress – Dynamically Process Image

I have images uploaded in the media library in WordPress. I would like to show the images with text composited on top of them using PHP’s GD or something similar.

If this were just a plain old PHP site, I could create a URL with a search parameter for the text and center it over my image with GD and serve it up. In WordPress, I am a little unclear how to accomplish this. I am not sure if it fits well into the concepts of Posts and Pages.

Read More

I can perform the programming myself. I am just looking for some pointers on how to get started.

Thanks,
Carl

Related posts

Leave a Reply

1 comment

  1. You can do that in WordPress, too. It’s mostly just a plain old PHP site. For example, you could create a PHP file that creates the composite given the text and the image and use it like: <img src="/composite.php?image=...&text=...">.

    Maybe all of the images are on a particular page or post type. Then you could create a custom page or post-type template that parses the $post->post_content for the images, does the compositing, and alters the image tags to point to the new composited images.

    Or, more generally in that vein, create a filter for the_content that does that for all posts.

    You might be able to hook into the WordPress upload system. As images are uploaded, you could create the composite. The wp_handle_upload filter might work for that.

    Or you could even create a WordPress cron job that scans the media uploads for new entries and creates the composites then.