[Resolved] Attachment’s corresponding post’s ID –> PHP Variable?
I’m creating a plugin that resizes uploaded images and autogenerates thumbs in a designated uploads/iconothumbs folder.
Short version: I have the attachment info – I’d like to get the corresponding post’s id, and store it in a variable.
Long version: I’ve done all the resizing. I’d like to store the new, resized thumbnails into files. However, I don’t know how to name the files.
The filename should be a) unique and b) echo-able from within the loop, with the post info, but without the attachment info.
I’m working from the
wp_handle_uploadfilter hook. I understand that each attachment has its own ID, but I need to somehow relate the thumbnails to their corresponding post. In the end, I want to have some kind of
<?php iconothumb1(); ?>tag that automatically generates the thumbnail for a given post from the loop.
This is my first PHP adventure, and my first WordPress plugin.
- The topic ‘[Resolved] Attachment’s corresponding post’s ID –> PHP Variable?’ is closed to new replies.