FlickrSync appears to be running as expected except that the actual fullsize image files appear to be systematically deleted from the site files directory (via cron?) after being sync'd from Flickr. The corresponding Flickr thumbnail files are left in place.
Running Drupal 6.8, with:
CCK 6.x-2.1
FileField 6.x-3.0-alpha5
FlickrSync 6.x-1.x-dev
FlickrAPI 6.x-1.x-dev
ImageAPI 6.x.1.2
ImageField 6.x-3.0-alpha3
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | flickrsync_tmpfile_fix.patch | 645 bytes | WiredRogue |
Comments
Comment #1
sejtraav commentedI am having this issue too.
Any solutions?
Comment #2
sejtraav commentedComment #3
benshell commentedI can't imagine why this would happen, but it'd be great if you could help debug this further. To start with, can you reproduce the problem without FlickrSync by just using the ImageField and/or FileField modules by themselves?
Comment #4
sejtraav commentedI have other imagefields, but only the one associated with FlickrSync is being removed
Comment #5
xolotl commentedhmmm, not sure how to reproduce further
I am also manipulating the flickr images via imagecache (6.x-2.0-beta5)...I wonder if it could it be that on transformation by imagecache, the original file from flickr is deleted by imagecache?
Comment #6
xolotl commentedOK, I think I figured out what was happening and apparently fixed it, although I do not know why it was happening.
Imagecache indeed seems to be the culprit, but it is in beta, so not unsurprising. I will try to file an issue in the imagecache queue.
One of the imagecache presets that I was applying to the flickrsync imagefield was apparently not working correctly. Maybe because the preset was failing, the images it was manipulating were deleted in the failed preset process.
I flushed that specific imagecache preset, and updated it (without changing any of its settings), which seemed to get the preset working again. Then if I updated any flickrsync imagefield from flickr, the preset in question worked and the original file was not deleted.
I then used the unix wget command with a file that listed the flickrsync update urls (eg, http://yoursite.tld/node/nid/flickrsync) for every node with a flickrsync image field to systematically update everything from flickr (make sure you temporarily enable the update from flickr permission for anonymous users so wget can do its work).
Now it's all working as designed, click on a header image at http://xolotl.org/.
Comment #7
xolotl commentedActually, perhaps I spoke too soon.
Gradually, all original sync'd flickr images still disappear from the files directory (thanks to cron?).
I can resync all images by updating from flickr (even using the bulk wget method above), but over time, all the original pictures will again disappear.
I'm now again suspecting something that happens during cron...perhaps there's an issue if anonymous users (eg, cron) do not have the update from flickr permission? I'm leaving that permission on for anonymous users as a test to see if the original images still disappear.
However, that's not a good fix, because I don't want anonymous users to see the update from flickr control on every page.
Comment #8
xolotl commentedFurther info: Allowing anonymous users the update from flickr permission has no effect. All original images sync'd from flickr still disappear in a few hours (I have cron set to run hourly).
Comment #9
xolotl commentedFurther info: original flickr image seems to be deleted during "update from flickr" after initial sync.
Images sync perfectly when they are first posted to flickr via cron. Immediately running cron after first sync does not remove original sync'd image. However, running "update from flickr" does remove both sync'd image and thumbnail.
Comment #10
elly commentedI think this just happened to me, also. I ran cron and it imported all my new images since the last import, but removed all my old ones! The thumbs are still in the directory but all the originals are gone, as reported.
In addition, I got a ton of these errors, which I'm not sure are related - those are really weird, I had no files named anything like these filenames on my site, but I thought I'd show them in case they are a clue.
:( :(
Comment #11
xolotl commentedFurther information: the original flickr image appears to be deleted when the "update from flickr" process is run another time after the original image is first imported.
Comment #12
xolotl commentedI think I've narrowed it down to an issue with line 788 in the flickrsync_download_photo function in the flickrsync.module file:
if ($file = field_file_save_file($filename, array(), $directory, TRUE)) {The line above successfully returns an array to $file, but does not successfully copy the file from the temporary flickrtemp directory to the permanent files directory. If the file already exists in the permanent directory, it is deleted.
The very next line deletes the temporary copy, so all copies of the original flickr image are gone.
Are we sure that the field_file_save_file is the right filefield function to use here? Or perhaps this is an issue with filefield module?
Comment #13
mariusooms commentedHmmm...experiencing the exact same behavior...odd though, out of all images a few do remain.
Subscribing to a solution.
Comment #14
mariusooms commentedI found a related issue somewhere else, but for another function file_save_upload. Maybe change field_file_save_file to the file_save_upload function together with file_set_status($file, FILE_STATUS_PERMANENT);? Seems files are not saved properly when cron runs before it is saved to the table? Just shooting one of in the dark here, but I do think the issue lies somewhere in this code.
Regards,
Marius
Comment #15
pfrillingI added the following code to the flickrsync_download_photo function below the field_file_save_file line that Marius was referring to:
After importing and updating flickr images, I checked the files table and the file status was changed from 0 to 1.
Phil
--
Comment #16
xolotl commentedpfrilling's suggested fix in #15 of #357711: sync'd images removed by cron? above did not work for me...files modified locally still get deleted in the next cron job
Comment #17
internets commentedI'm also having this problem.
Using Drupal 6, image_cache, cck image field, and a views slideshow. When I initially setup my images and sync them from flickr the slideshow is working great. I have views slideshows generated based on my Flickr images. Then I check the next day, I believe after cron has run. No slideshow, no images showing up until I go to the node and 'update from flickr'.
Any working fixes? I'm going to make sure I'm using the latest version of all related modules, try new image cache presets. Anyone have a fix for this?
Comment #18
internets commentedOk well after some trouble shooting and re-reading of this thread I think I have got everything working correctly (for my specific needs).
The problem was any time cron ran the images would disappear. The original files were being deleted. The images would also disappear if I ran "Update from Flickr" on any node created with Flickr Sync.
I added this: around line 789 of flickrsync.module
When I tried file_save_upload as recommended above my images were not saving properly unless I'm using it incorrectly but the params all seem to match up with the description in the drupal API.
After adding the above code the images are not disappearing when cron runs and new images are automatically imported / created. If I run "Update from Flickr" on any flickr sync node the images still disappear.
So it seems to be working ok as long as no one ever uses the "Update from Flickr" link. I haven't noticed any other issues yet and I have ran cron a number of times to verify that newly tagged Flickr photos automatically start showing up in my slideshow.
*edit*
Another note after some more testing I was wondering if I could untag images in Flickr and then they would then be unpublished / deleted from my site when cron runs the 'flickr-sync'. The images remain published / active. Are they supposed to get unpublished if the tag is removed on flickr? That is the point of a 'sync' correct?
Maybe this is related to the above edits?
I'll just manually unpublish any images I don't want for now.
Comment #19
glove commentedTaking a look at this, I see the likely culprit being line 667 in the flickrsync.module file:
$file = flickrsync_download_photo($flickr_photo, 'largest');
When flickrsync_download_photo returns false (often timing out with Flickr), $file stores as FALSE. However, since there is no check for $file, it continues to rebuild the node and submit it with an empty file. Below is the suggested fix:
// get the path to the largest available image size (cached locally)
$file = flickrsync_download_photo($flickr_photo, 'largest');
if (!$file) {
drupal_set_message(t("Couldn't download file, unable to save image %photo_id", array('%photo_id' => $photo_id)));
return FALSE;
}
Since this happens sporadically, I'm still checking to see if this does the trick.
Comment #20
elly commentedglove - interested to know if this solution worked for you. please update us!
Comment #21
WiredRogue commentedWith glove's change (#19), I've added the file_set_status of internets (#18)
So far this is working on my test system. Entries in the files table are saved with a status of "1" instead of "0" and are not removed during cron runs. I overwrote the DRUPAL_MAXIMUM_TEMP_FILE_AGE in settings.php to be able to test this in minutes vs hours. ( define('DRUPAL_MAXIMUM_TEMP_FILE_AGE', 300); )
The following code is the patch:
Comment #22
cashwilliams commentedThere hasn't been any activity on this thread for around 6 months, but I have recently installed Flickr Sync and am having this issue so I figure its still a problem.
I am going to test the patch above in #21 and I'll post results. Any idea on when this issue will be fixed in the release?
Comment #23
cashwilliams commentedThe patch seems to have fixed the problem. My site has been running for about a week now without losing any of the images.
However, I know have an issue with the number of photos imported. In the settings, the maximum number of flickr images to import during each cron run isn't working as it should. With the value set to 5, the same 5 images are imported over and over, so I never had more then 5 images. I've changed this number to 40, but now I'm limited to 40 images. I'm not sure if this is a separate issue, or an issue caused by the patch. I'm going to look for another thread or open a new one.
Comment #24
cyberwolf commentedSubscribing.
Comment #25
xolotl commentedThe patch in #357711-21: sync'd images removed by cron? seems to have fixed the issue for me as well, however I did a couple of things to start fresh which may or may not be necessary to make it work:
Flickrsync'd photos then should gradually resync with each cron run and not disappear once in place.
Comment #26
gclicon commentedI have tested and committed the patch in #357711-21: sync'd images removed by cron?. Marking this issue as fixed.