Convert image

Convert image [Paid] 4.7

No permission to buy ($35.00)
It should be included, a addon should not be allowed to jack up people's databases and just leave them jacked.
I'm just glad I figured out the root cause and Andy fixed it. I'm guessing Andy didn't want to run it automatically since updating the database is risky business, and you should backup your site/database before doing so.

Note: Convert Image previously set the attach_count correctly for all new posts. It was only incorrect when editing posts with existing attachments and adding new hotlinked image(s). The bug where attachments are no longer displayed only occurs when you add x hotlinked images to a post with existing images, save the post, then subsequently delete x or more attachments.
 
You should not screw up people's databases to begin with, but it happens. A update of the addon should fix the databases. Users should do a backup before installing/updating any addon.
 
You should not screw up people's databases to begin with, but it happens. A update of the addon should fix the databases. Users should do a backup before installing/updating any addon.
Personally, I don't backup the site when I add add-ons. I trust they won't do anything bad to my system. That's probably a good idea though. I agree the update should fix previous mismatches, but not my circus, not my monkies :).
 
Oh you should always make a backup when adding or updating addons, I have seen people have to resort to backups weeks or months old because a add-on has issues while updating.
 
Oh you should always make a backup when adding or updating addons, I have seen people have to resort to backups weeks or months old because a add-on has issues while updating.
I will from now on :). I run daily automated backups, but still nice to have a snapshot to roll back to if things go boom.
 
I confirmed with Andy it does not. Here is a update query to fix all the existing attach_count mismatches:
Code:
UPDATE xf_post AS post
INNER JOIN (SELECT content_id, COUNT(content_id) AS count FROM xf_attachment
WHERE content_type = 'post'
GROUP BY content_id) attachment ON post.post_id = attachment.content_id
SET post.attach_count = attachment.count
WHERE post.attach_count <> attachment.count
After you run it you can check to make sure there are no more mismatches:
Code:
SELECT xf_post.post_id, S.count, xf_post.attach_count FROM xf_post
INNER JOIN (SELECT content_id, COUNT(content_id) AS count FROM xf_attachment
WHERE content_type = 'post'
GROUP BY content_id) S
ON xf_post.post_id = S.content_id
WHERE xf_post.attach_count <> S.count

DISCLAIMER: updating the database is risky business, and you should backup your site/database before doing so. I am not responsible for bad things that may happen :)

FWIW if you have a large number of posts this isn't going to work very well. It'd be much better as some sort of rebuild system
 
I'm just glad I figured out the root cause and Andy fixed it. I'm guessing Andy didn't want to run it automatically since updating the database is risky business, and you should backup your site/database before doing so.

Note: Convert Image previously set the attach_count correctly for all new posts. It was only incorrect when editing posts with existing attachments and adding new hotlinked image(s). The bug where attachments are no longer displayed only occurs when you add x hotlinked images to a post with existing images, save the post, then subsequently delete x or more attachments.

So when using convert image all this would also have happend when there were already attachments in a post?
 
FWIW if you have a large number of posts this isn't going to work very well. It'd be much better as some sort of rebuild system

Which is why the developer should be fixing the issue in the update, not expecting users to fix his mistakes on their own.
 
Hi @AndyB,
I am planning to move my old 1.4 to 2
Lot of images and video in posts are linked to Xengallery.
XenGallery is not yet compatible with XF2.
Do your addon could parse existing post and store Xegallery images URL to your addon URL format ?

Thanks
 
Nice addon, here are some fixes you could implement if you want.

1.) Support Webp images -> convert to png automatically. (PHP 7.1+)
2.) Regex fails for some posts like \nURL, the following will match everything.
3.) Urls will sometimes start with a space and end with a space

Thanks again for the awesome addon.
 
Last edited:
Top Bottom