plainblack.com
Username Password
search
Bookmark and Share

    

Overwritting images in the Assets Bin

User BoxWrench
Date 3/1/2007 5:50 pm
Views 1502
Rating 5    Rate [
|
]
Previous · Next
User Message
BoxWrench

What is the best approach to overwriting files in the assets bin?

If I drag an image off of my site and edit it in Photoshop, then want to upload it back to my site and overwrite the old image, the file pile feature adds it back in as a copy in the assets bin.

Is there a simple way to overwrite when using the file pile to upload?  

 Thanks.

 

 -BoxWrench

BoxWrench.net

--- (Edited on 3/ 1/2007 5:50 pm [GMT-0600] by BoxWrench) ---



Back to Top
Rate [
|
]
 
 
Jesse

It's done that way for a reason - version history.

When you edit an image, it creates a new one and keeps the old one around as part of it's version history - this way you can roll back to the old version if there's a problem. 

You can do two things to remove all previous versions of an object - either purge the old revisions for your entire site (and there's a scheduled workflow which does that already, though it's set to either a year or 90 days or something from memory by default)

Or you can delete the old revisions for that particular asset by going to the Assets View by clicking on More next to the item in question and selecting Revisions, then deleting all the old revisions of that asset.

Jesse 

-
If my comment is useful, rate me - I can always use the karma! :)
Join us on the #webgui irc channel on freenode! (I use the nick Radix)

--- (Edited on 2-March-2007 8:18 am [GMT+0800] by Jesse) ---



Back to Top
Rate [
|
]
 
 
BoxWrench

Right, of course the versioning...it makes sense that the previous image sticks around for two reasons I would figure: 

1. Even when deleted from the Assets bin, the image still exists in the trash.

2. The new uploaded image won't show up until the line of code in the style's appropriate template is changed to reflect the new URL of the changed image.

 

 So even if I have auto commit for new content turned on, anytime I upload a simple alteration to an image, I always have to go into the style template and change the image tag to the new images' upload URL location and then delete the original and trash it? 

Would be nice if there was a simple one step overwrite for this type of instance where you're certain that you want to just replace an image with an updated version. Seems to be an unneeded step on some occasions to  have to change a line of code.

 Would anything show up at all if an image was changed and re-uploaded and then the original image was deleted and the old versions were purged? 

 

--- (Edited on 3/ 1/2007 10:33 pm [GMT-0600] by BoxWrench) ---



Back to Top
Rate [
|
]
 
 
Jesse

If you're having to change the url of the image all the time, then that's because you're using the url of the asset directly in your template then.

When you create an image object it has two urls.  One is the webgui url to the image object (say /home/image.jpg), and the second is the actual image itself which are given a /uploads/xxxxx/xxx.jpg kind of url.

If you're linking to the latter, then yes, once your asset changes the url will no longer be pointing to the right one.

Two ways to beat this. One is using the ^FileUrl(<asset url>); macro - this will convert the asset url into the image url on the fly.

The second is using the "enableStreamingUploads" : "1" config option.  This allows you to use all asset urls directly and have them auto-converted on the fly.  This is a config option which goes in your webgui.conf file.

Another useful config setting related to this is  "richEditorsUseAssetUrls" : "1" - which ensures that any images you add through the rich text editor use the asset urls rather than the direct image url.

Both these options have a bit of a performance hit which is why they're not in the core, but they make life a lot easier IMHO.


Jesse 

-
If my comment is useful, rate me - I can always use the karma! :)
Join us on the #webgui irc channel on freenode! (I use the nick Radix)

--- (Edited on 2-March-2007 1:05 pm [GMT+0800] by Jesse) ---



Back to Top
Rate [
|
]
 
 
BoxWrench

 Thank you very much for that explanation. Well deserved karma coming your way. 

 I'll have to look at what is set in the ^FileUrl macro. Right now, I'm just using the WebGUI 7 Style 03 so the  macro is in use as you mentioned. I'm sure it's just a case of me not purging assets from the trash for the macro to kick in and start serving the newly uploaded image instead of the one that was thrown away. 

Interesting point about the "enableStreamingUploads" config. Will be worth consideration when the time comes.

Thanks again!

 

 

--- (Edited on 3/ 2/2007 12:28 am [GMT-0600] by BoxWrench) ---



Back to Top
Rate [
|
]
 
 
    



© 2012 Plain Black Corporation | All Rights Reserved