开发者

static img filename link in database-text, or "replace" function in database / asp.net.( together with urlrewrite)

开发者 https://www.devze.com 2023-04-08 06:49 出处:网络
A site I am currently working with allows users to upload images onto a page together with some text they write.

A site I am currently working with allows users to upload images onto a page together with some text they write. like a blog or logbook.

I use tinymce to let them edit the text and add images.

due to the urlrewriting module I work on I have to change the img src for each of the images that is added to the page. from

"/images/images_1/....jpg" to http://user1.mydomain.com/images/images_1/

"_1" is the id of the user account. and each user has their own subdomain. and each page is later viewed from a rewrited url like:

user1.mydomain.com/2011/09/pagename.aspx

so, the problem when using url rewrite the path for images is not working. That's why I have to change the path inside each text document.

As I see it, I have 3 alternatives:

1: I replace the img src string when the text is saved, used with asp.net c#. this is easy BUT! If the user wants to change their subdomain nmame I have to update each and every one of the pages for that user inside the database. and replace the img src.

2: I use replace function in mySQL for each page visit and replace the code more dynamically.

3: I use replace function in asp.net for each page visit.

alt. 2 & 3 is not good,开发者_开发百科 a because it is possible to view a lot of pages at the same page. (like a blog, a whole month on one page, lot of page entries) and I think that the replace function eats hardware?

So, what do you think about this? what should I choose?


I solved this by adding another subdomain.

images.mydomain.com

no need for change if user changes his username :D

0

精彩评论

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