• Resolved Rick Hellewell

    (@rhellewellgmailcom)


    The old ‘tmptitle’ error, which happens when there are too many pictures in the mail attachment, or when the Postie import times out, creates an additional copy of every picture each time it tries to re-process the same email.

    The result, if the admin is not paying attention, is multiple copies of the same image cluttering up the Media folder.

    For example, if an email has 10 images, and the email times out or fails for some reason, the result will be up to 10 images in the media folder. Then the next processing of the same email – since it wasn’t completed, it wasn’t deleted – fails, and you get up to 10 more images in the media folder. Repeat hourly (or whatever the processing interval is), and you now have tons of images in the Media folder that have to be deleted.

    It would seem that a better process would be for Postie to check if the email image has already been processed once – the source filename should be in the Media folder. If the image has alreasdy been processed once, then that image name could be kept in an array, but not uploaded again. Only images that haven’t been processed on prior processing of that email should be uploaded on the next processing.

    This would help ensure that the email would eventually be fully processed, and a post completed. This would also reduce the number of ‘tmptitle’ posts that also have to be manually deleted.

    This would be a great improvement to reduce the number of tmptitle posts, and the number of uploaded but not ‘associated with a completed post’ images in the Media folder.

    Postie works great when there are just a few images in the email. But Postie is not good at recovering from failed ‘tmptitle’ posts. Even with image size limits set higher than default, and processing timeouts increased.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Wayne Allen

    (@wayneallen-1)

    I appreciate the time and thought you’ve put into trying to solve this issue.

    Unfortunately WordPress can change the name of the image when it is saved (to make it unique) so there is no guarantee that image name in the email will match the one in WordPress. Also some email clients use generic names like image1, image2, etc.

    If your main concern is extra images you can use one of the plugins described by https://wpengine.com/resources/wordpress-media-library-clean-up/#Plugins_For_Image_Cleanup to remove unused images.

    Thread Starter Rick Hellewell

    (@rhellewellgmailcom)

    Cogitating on this issue, I note:

    1. Image file names in an email do not change.
    2. So, grab the image emails into an array. Copy the image files into a temporary folder.
    3. Grab the text in the email and convert it into a new post. Set the post status to draft.
    4. Grab the subject line in the email and use it as the new post name.
    5. Store the image file name array, and the post ID into a temporary setting (in the options table, or wherever)
    6. Process each image file in the array. When processing is complete, add the image to the post, and remove the image file name from the array in that settings table row.
    7. Repeat step 6 until all images are processed. If all images posted (no more files in the settings array), delete that row, and set the new post status to publish.
    8. If the processing is stopped for any reason, the unprocessed image file names will remain in the table. The next CRON processing will look at the table for any unprocessed files, and process those into the post ID (post ID stored in the settings table temp row.
    9. Repeat step 8 as needed to process all images in that message to the post. If done, set post to ‘publish’.

    This process will ensure that there are not multiple images processed into the media area, nor will there be multiple ‘tmp titles’ cluttering up the Post list. This would be a great improvement, and would eliminate all of the support messages about excess images and tmp_titles, and mailings that don’t make it into the blog.

    Plugin Author Wayne Allen

    (@wayneallen-1)

    Thanks. However the key issue is that different emails can have different images with the same name.
    It would be possible to do some additional bookkeeping via metadata about original image names and email ids, but this doesn’t really seem to be a widespread issue.
    If desired you could create a Postie AddOn for your specifics. See https://postieplugin.com/extending/

    Thread Starter Rick Hellewell

    (@rhellewellgmailcom)

    Assuming that when an email has images attached, each image has a file name or name of some sort. Those names would be unique to that specific email.

    So processing an email would grab those image file names, place them in a temp array for use when that email is processed. Once the email subject and text is processed, any pictures are processed.

    Each email has several things that would be processed. THe message ID would be used as a key to the other parts of the same message. Message ID 12, for example, would have subject and text things that would be stored in a temp record. That record would also have the array of image file name (image1.jpg, image2.jpg, etc).

    That ‘hunk’ of info (subject, text, array of image file names) would be used to process the email. As eash hunk of info (subject/text/immage item) was processed, that item is flagged as ‘done’. If the entire message is not fully processed, then the next CRON for processing would see that record as not completely processed, and would pick up where it was interrupted.

    Only when a single message is fully processed, would that temp record row be deleted, so the next message could be processed.

    (Sort of late here, and I just got home from driving 13 hours, so not very lucid, perhaps.)

    Plugin Author Wayne Allen

    (@wayneallen-1)

    I agree with your logic that it could be done. However, it would require completely reversing how Postie processes emails currently as Postie extracts images first so that it can generate the markup necessary for inline images.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘TmpTitle creates multiple copies of images’ is closed to new replies.