Drupal 6: Filefield deletes old version of updated images - drupal

Here's the scenario: I have admins updating images uploaded via CCK filefield. I also have emails going out daily with an imagecached version of those images.
So when an admin updates an image, filefield deletes the old image and adds the new image (renaming it - (adding a _0 at the end) if the filename is the same as before).
All fine and good in normal situations, but what happens to the images referenced in the previous emails that went out prior to the update? They disappear, leaving an unprofessional looking placeholder or gap (depending on the email client viewing them).
Is there any way I can set filefield to not server-delete the old images after an update?
In the case of an updated image of the same filename, it would ideally just overwrite the old image without changing the name, though that isn't as important as the first point.

The Upload File Replace (for filefield CCK) module should do what you need. Some more details about this module (from its project page):
This is a small utility module that automatically stops Drupal from renaming new files upload via filefield CCK. When 2 files with the same name exist, the older files will be renamed.

Related

AEM DAM image replace - references in pages not updating

I have a problem with references to an image not updating in pages that are using that image.
This is the steps that the users are reporting
go to /siteadmin#/content/dam/
on the "new" dropdown menu, select "new file"
select an image file that is a different image but has the same name as a file that already exists
upload the file and when asked that a file already exists, choose replace
activate the file when the upload completes
The problem is that when I check pub I can see the image is updated, and if I navigate to the path of the image, for example:
pub1.mypub:4503/content/dam//my-image.png
I can see the new image I replaced the old one with
the problem is that pages that were referencing the image, specifically the image component, still shows the old image. I've check flush rules, checked workflows and nothing seems to work
The one thing I noticed is that in pages that are referencing the image the path is like this
/content//_jcr_content/my-component/my-component-parsys/columns/parsyscenter/image.img.jpg/1538602163986.jpg
so it seems the path it is using is like a generated path and not the same path as this one: pub1.mypub:4503/content/dam//my-image.png
im at a complete loss, I honestly do not know what else to check, has anyone ran into this and figured out how to fix it?
this is on aem 6.3
the problem is that in pubs the image being referenced in the component does not update, and since it does not update in pub, it never updates dispatcher
You can try activating the referenced pages after the image has been published. Since the page on publish has reference to the previous image.

Liip ImagineBundle custom resize without caching

I am using Liip ImagineBundle for managing the pictures in an auction listings project. The setup is as follows - when an auction listing is being created I am using Plupload to upload the picture set (with AJAX prior to persisting the auction). The pictures are uploaded into /pictures/temp folder with a temporary hash name. Upon persisting the entity, a Doctrine Subscriber renames the uploads in the temporary folder to use a format:
{AUCTION-ID}-{SIZE}-{TIMESTAMP}.{EXTENSION}
where the size is the version of the image - XL, large, medium, etc. and based on the timestamp creates a subfolder as:
/pictures/{YEAR}/{MONTH}/{DAY}/{PICTURE}
This allows for preventing millions of pictures to end up in a single folder and slow the file system. I am using a custom file loader and cache manager to resolve the pictures based on the timestamp. It all works perfectly fine but I have a request to display the uploaded pictures in a preview while doing the Plupload. The problem is in the resizing and caching with the ImagineBundle. What I would like to achieve is have the uploaded picture (the {HASH}.jpg in /pictures/temp) be resized to a specific size and at the same time a thumbnail to be generated off that as {HASH}-thumb.jpg. I know I can make it with another file loader and a cache manager but I was wondering whether it is possible to done via the bundle in some other way which is simpler as both these files are temporary ones and will be deleted upon the creation of the auction.

Pasted folder invisible to Plone but not to Zope

I am getting a very weird problem when attempted to cut-and-paste folders from one place to another in our intranet Plone site. The paste operation returned the error "Nothing in the clipboard". However it had gone and removed the folder from where it had originally been, and it looks as though it hasn't been inserted yet into the new location. Showing the Content view of the folder in which the paste happened does not show the pasted folder. However, through the ZMI interface I can see that the paste has happened. Clearly something threw an error before the pasted content was moved successfully, and it is left in a weird state.
For example the site search can find the content in the new pasted location, and the bread-crumbs show that those content pages are beneath the folder which is otherwise invisible to Plone.
Is it possible - maybe through the ZMI - to get this folder to be visible in the Plone world?
That is a weird bug. The quick solution to get the folder to display in Plone is to go to the ZMI, then visit portal_catalog, then locate (in one of the tabs) the button to rebuild the catalog. This ought to regenerate the catalog indexes (which may have failed to be updated when you did the cut/paste, through no fault of your own) and thus all the views (folder listings, etc) in Plone will display the new index (the views use the catalog to know what to display).
The same problem as I copied a folder from one language folder to an other the pasted object was only visible in ZMI
As fRiSi said the problem was the language category in Categorization tab > Language
Because I had many subobjects inside a folder I run the script below to change the language categorization recursively
Based on Convert LinguaPlone sub-language back to language for all content?
path = '/'.join(context.getPhysicalPath())
for brain in context.portal_catalog(path={'query': path, 'depth': 1000}, Language="it"):
obj = brain.getObject()
obj.setLanguage('en')
obj.reindexObject(idxs=['Language'])
print brain.getURL()
return printed

How do I add version control to uploaded files / images using Plone 4.1?

I want to activate version control facility for uploaded files using Plone 4.1. E.g.Whenever an image is edited using Products.ImageEditor in Plone, I want the entry to appear in the history for the image.
First thing to activate version control for images is to:
1) go to site setup
2) click Types
3) Select Image from the drop down
4) select Automatic versioning
Even with that, I don't think versioning will not automatically be performed for ImageEditor changes. ImageEditor just sets the field value for the image and does not emit any object modified events which I assume is required for plone's versioning to kick in.
FWIW, I'm the author of Products.ImageEditor. You can submit a ticket for the issue if you'd like: https://github.com/collective/Products.ImageEditor/issues

cck remote file (image) field - I want to keep the cached copy of the image when the node is deleted

I use the Remote File module for a cck field displaying a remote image. It works with a known issue: images are reloaded on every edit http://drupal.org/node/395256
And as i do tests with lots of nodes and delete them afterwards, the images cached in filesystem become deleted too. Is there a way to tell filefield(?) not to delete them?
edit
Meanwhile found http://drupal.org/project/filefield_sources which works very nice on manually created or edited nodes. But there is no way to make filefield fetch the image on assigning the url to the place where it shows up when i let print_r($node) show it to me.
See also my post to this (wont-fix)issue http://drupal.org/node/590756#comment-2774472
Yes, there is.
You'd need to create an interface between your node and the file so when you delete the node, the file stays in place. Effectively, you're just deleting the association, not the file.
Perhaps this module saves to the files table and the reference to the file exists already.
You could develop a third party module that stores all your external files and has a GUI or some other interface to select them again for new nodes
Or, you could create a specific content type and save the files as separate nodes. Then you'd use node reference to join them.
Alternatively, the developer of that module says he'll add features if you pay him. However he does not guarantee it from what I can see :)

Resources