1

I am trying to use timthumb.php for image processing on my site. When I try to pass image url to timthumb.php using: <img src="'.home_url().'/timthumb.php?src='.$image_attributes[0].'&w=200"/> It returns page not found error.

$image_attributes[0] is the absolute URL of the image.

When I logged in using any user account, it works perfectly but for non-logged in users it returns page not found error.

if I pass anything else except URl or if I remove http://, it returns without any issue. I need to pass image URL so that I can generate thumbnails but its not working for only guest users.

4

2 回答 2

2

问题在于绝对 url 没有作为参数传递,所以 timthum 没有任何问题。我只是通过在使用 str_replace() 传递时转换 url 的某些字符来更改 url,然后我再次将传递的参数更改回 timthumb.php 中的 url。现在它工作得很好。

于 2013-05-16T04:31:53.630 回答
0

使用“template_directory url”设置文件路径

<img src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo $image_attributes[0]; ?>&h=126&w=330&zc=1" alt="<?php the_title(); ?>" width="330" height="126" />
于 2013-05-10T12:43:03.483 回答