breakskater wrote:
Oliver, I've already done this. The format is productname-[imagesize].[ext]. Most logic is wrapped up in a single simple control, decoupled from the UI; it could be easily ported to MVC. Take a look at my site in the signature. It's too difficult to merge the code in using a diff tool. If you are interested PM me.
New York wrote:
Maybe this is naive because I've not looked at that section of code in detail, or maybe I'm missing something, but I would think this should be easy to do. The displayed image comes from a cached copy generated in folder ...\Content\Images\Thumbs. I would think the code update would just be a change in the name of the generated file.
(and then I wonder, does this cache ever get cleared, and if not, that's a whole lot of diskspace eventually, so what's the point of storing image in DB? :)
(I think this discussion should move to a new thread)
(and then I wonder, does this cache ever get cleared, and if not, that's a whole lot of diskspace eventually, so what's the point of storing image in DB? :)
(I think this discussion should move to a new thread)
breakskater wrote:
The image isn't stored in the database unless configured that way. It's better to have images stored on the file system, so they will have Canonical urls; or, if possible, stream it using a Canonical url or url rewritting mechanism of some sort.
The way I did it was to store the filename which could change (i.e. Update a Product's, Category's, Manufacturer's Name) and you also have to take SEO Names into consideration (i.e. it's slightly better to use a hyphen rather than an underscore) and numbers are better to be left on the end (this SEO enhancement still needs to be implemented with 2.0). A lot of thought went into the control that generates the different size images. It isn't as straight forward as you might think, especially since the old image logic was sprinkled throughout numerous codebehind files and not encapulated in a central place. Plus, you have to wire it all up to work with Manufacturer, Category, Avatar, and other images, and you must take into account additional photos. If your interested, PM me and we can discuss it off of this thread.
I was commenting on just the SEO File Names, and providing an easy way (probably just a few lines of code) to do it, and satifies your requireents:
The images are copied to the file system (...\Thumbs)
If product name, category, etc changes, then a new file would be generated with the new name