Resource icon

MetaMirror 1.6.1

No permission to download

Luke F

Well-known member
This is brilliant, just a couple of things:

- Possibly move the new column on xf_post to installation code rather than doing the describe table every run
- For the option ids you should use a prefix to avoid conflicts on common words like 'Ignore' and 'enabled'
- Maybe make the cron run less often and with a larger batch by default
- If possible add some detection of dynamic images (especially when the new signature code is added), by server cache headers or url (by presence of query string and/or '.php') or something. It's quite common on gaming forums that you will get people putting dynamic statistics images in their signatures
 

AndyB

Well-known member
The problem with this add-on is that to do this correctly the converted image links should be made into attachments. That way when a thread or post is deleted the attachments are deleted also. With this add-on you will end up with thousands of orphaned images wasting hard disk space.
 

Mick West

Well-known member
This is brilliant, just a couple of things:

- Possibly move the new column on xf_post to installation code rather than doing the describe table every run
- For the option ids you should use a prefix to avoid conflicts on common words like 'Ignore' and 'enabled'
Oops, I thought the scope the options was restricted to an add-on, will to.


- Maybe make the cron run less often and with a larger batch by default
- If possible add some detection of dynamic images (especially when the new signature code is added), by server cache headers or url (by presence of query string and/or '.php') or something. It's quite common on gaming forums that you will get people putting dynamic statistics images in their signatures
You can add .php or ? to the (soon to be renamed) ignore option.
 

Mick West

Well-known member
The problem with this add-on is that to do this correctly the converted image links should be made into attachments. That way when a thread or post is deleted the attachments are deleted also. With this add-on you will end up with thousands of orphaned images wasting hard disk space.
That never occurred to me, as I rarely delete posts and threads. If it becomes a problem then a "delete orphaned images" option could theoretically be added.
 

Luke F

Well-known member
Where you're checking isset($url_info['host']) should probably do ['path'] too as I've had a few posts giving undefined index: path
 

Mick West

Well-known member
Where you're checking isset($url_info['host']) should probably do ['path'] too as I've had a few posts giving undefined index: path
So you mean like:
PHP:
                if($ignore || !isset($url_info['host']) || !isset($url_info['path']))
?

Can you give me an exmaple URL that fails? Something like
?

I'll add that to 1.1, coming soon
 

Luke F

Well-known member
So you mean like:
PHP:
                if($ignore || !isset($url_info['host']) || !isset($url_info['path']))
?

Can you give me an exmaple URL that fails? Something like
?

I'll add that to 1.1, coming soon
Didn't catch which url it was, but yeah it was probably just malformed

And another thing, probably need to consider the query string for situations such as people hotlinking google images thumbnails (typical :p)

Code:
         if(!empty($url_info['query']))
           $url = $url_info['host'].$url_info['query'].$url_info['path'];
         else
           $url = $url_info['host'].$url_info['path'];
 

Mick West

Well-known member
Mick West updated MetaMirror with a new update entry:

Added rehosting of images in sig, renamed options (require reinstall)

Images in signatures are now (optionally) rehosted the same as images in posts.

A change to the naming of options (I did not use a prefix) requires that you uninstall and re-install MetaMirror in order to delete the badly named options. Sorry about that.

This means you will need to re-enter your ignore strings, and then re-enable the add-on.
Read the rest of this update entry...
 

JulianD

Well-known member
Wow! Great Addon! I might take your code and modify it someway to fit my needs!

For anyone expecting to use this on signature images, take into account dynamic signatures. My users love to use that kind of signature and this addon would break them.
 

Mick West

Well-known member
Didn't catch which url it was, but yeah it was probably just malformed

And another thing, probably need to consider the query string for situations such as people hotlinking google images thumbnails (typical :p)

Code:
         if(!empty($url_info['query']))
           $url = $url_info['host'].$url_info['query'].$url_info['path'];
         else
           $url = $url_info['host'].$url_info['path'];
Shouldn't that be:
Code:
         if(!empty($url_info['query']))
           $url = $url_info['host'].$url_info['path'].$url_info['query'];
         else
           $url = $url_info['host'].$url_info['path'];
 

Mick West

Well-known member
Hmm, yes, I see it rehosts the google cached images fine, but strips off the query for the filename, so they will overwrite each other depending on what Google server hosts the. I shall fix this, as it also applies to any image generated with queries.
 

Mick West

Well-known member
Wow! Great Addon! I might take your code and modify it someway to fit my needs!

For anyone expecting to use this on signature images, take into account dynamic signatures. My users love to use that kind of signature and this addon would break them.
Depending on the variety of dynamic signatures, that could be handled with ignore strings. Or just switch of the signature re-hostingin the options.
 

Luke F

Well-known member
Shouldn't that be:
Code:
         if(!empty($url_info['query']))
           $url = $url_info['host'].$url_info['path'].$url_info['query'];
         else
           $url = $url_info['host'].$url_info['path'];
Swapping them round is a nice lazy way to keep extensions intact :)
 

Mick West

Well-known member
Last edited:

Mick West

Well-known member
I just verified you can disable rehosting of most dynamic images by adding a ? to the ignore strings
Options_ MetaMirror Image Reshosting | Admin CP - Metabunk-2.jpg
 

dvsDave

Well-known member
Is there a way to run the job and just tally up what the total storage needed would be? I could see this getting rather expensive if you pay for storage ala carte.
 
  • Like
Reactions: DRE
Top