[wp-hackers] Problems with dynamic image processing.

Otto otto at ottodestruct.com
Wed Jun 13 20:36:29 UTC 2012


The 404 status header is set by the main query, before it gets to
template_redirect. To override that, you'll need to call
status_header(200) for the case where it's not actually supposed to be
a 404 anymore for your own code returning something different.

Basically, your rewrite rule was parsed into query_vars properly, and
then the main query ran, didn't find any matching posts, set the 404
status and the is_404 flag, and then came back. When the template
loader runs, you're hooking into template_redirect, and saying "no,
this isn't a 404, it's my special case". Then you probably return
content type and the image and such, but the 404 was already set in
the header. status_header(200) will let you override that.

-Otto



On Wed, Jun 13, 2012 at 3:20 PM, JimmyMacedo <contato at jimmymacedo.com> wrote:
> Hello, hakers.
> I'm trying to use a class for manipulating images inside of WordPress. To
> process measurements and things like watermark in real time.
> But whenever I make a request, the WP returns a "404 not found" and
> (strangest of all) loads the image immediately. And this is repeated with
> each new refrash. (ignoring any cache ...).
> Recalling that the class works perfectly fine outside of WP.
> Anyone know how to help me?
> Here are a few pictures of the incident and the code I'm using is in
> pastebin.
>
> http://pastebin.com/1fRBF237
>
> Jimmy Lopes de Macedo
> contato at jimmymacedo.com
> www.jimmymacedo.com
>
> <http://www.facebook.com/jimmymacedo> <http://twitter.com/jimmymacedo>
> <http://br.linkedin.com/pub/jimmy-macedo/27/7b4/242>
> <http://lattes.cnpq.br/4509397096603463>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list