开发者

generating personal image to use as signature

开发者 https://www.devze.com 2022-12-17 10:11 出处:网络
i want to make a personal image, that shows the last 3 items from the user (so he can use as forum signature, but it cant be a dynamic image like user?id=1 because most forums blocks that)

i want to make a personal image, that shows the last 3 items from the user (so he can use as forum signature, but it cant be a dynamic image like user?id=1 because most forums blocks that) im planning to use GD, thats not a problem but: - to update the image as data is inserted, do i just put a "update image" in the insert script or there's a better way? i want to update the image in a max time of 5~10 minutes from the insert

-if 500 users are using this service, is that going to demand way too much resources from the server? not bandwith, i mean to create the image each user normally updates his items 3 or more times 开发者_如何学Pythona week, not that much

  • since its only update on user actions, cache is not envolved, right?

thank you


it wouldn't be a performance issue (the estimated weekly load - 1500 images - can be generated in a few seconds). you could also generate the image only when it's requested and cache it...

you could get around the dynamic url in the forum signature problem, by using a clean url without a querystring:

http://www.my.site/my/image/123

mod_alias can redirect that internally to the image generator...


If you don't want the user to have to wait for the script to update his sig when he uploads, you will have to set a flag in the db for that user, then have a cronjob or some such automated script running every 5 minutes or so. The cronjob can query the DB to see which users need updating, then perform the update.

If you have the image name stay the same (aka "user_15_sig.jpg" for example), the image may be cached by the browser. SO even though you updated the image on your server, users that have that image cached will see the old one. You can get around that by appending a variable to the image name (aka "user_15_sig.jpg?temp=123). BUT since you said you wanted to avoid having any dynamic context to the image (even though it wouldn't be dynamically generated), you would have to make the image name update somehow. One way would be to have a field in the DB that holds the timestamp of last update on that user's image, then append the timestamp to the image name when you save the updated version (aka "user_15_sig_1234567.jpg" where 1234567 is the timetamp.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号