thomas Posted October 7, 2013 Share Posted October 7, 2013 Hello, I have an imagefield set to limit=1 and I try to replace this image via the API: $video->of(false); $video->teaserbild->removeAll(); $video->save(); $video->teaserbild = 'http://new_image.jpg'; $video->save(); The result in the admin is a broken image (missing file) as the first image (which was supposed to be removed) and the new one intact as second. I'm on PW 2.3.0. I've had this problem for a while and can't seem to solve it. Can someone help? Thanks, thomas Link to comment Share on other sites More sharing options...
adrian Posted October 7, 2013 Share Posted October 7, 2013 I think you want deleteAll() rather than removeAll() which works on WireArray, not on files/images. Let us know if that solves your problem. Link to comment Share on other sites More sharing options...
thomas Posted October 7, 2013 Author Share Posted October 7, 2013 Hi Adrian, thanks for the tip but unfortunately it doesn't change anything. I ran $video->of(false); $video->teaserbild->deleteAll(); $video->save(); $video->teaserbild = 'http://new_image.jpg'; $video->save(); on a page with one image already uploaded and got this error: <b>Warning</b>: unlink(/www/htdocs/v133155/bigair2/site/assets/files/51666/img_20131001_110155.jpg) [<a href='function.unlink'>function.unlink</a>]: No such file or directory in <b>/www/htdocs/v133155/bigair2/wire/core/Pagefile.php</b> on line <b>304</b><br /> and the result remains the same: (with the second one being the new one and the first (upper) one being the one that supposedly couldn't be deleted ...) Any hints? Thanks, thomas Link to comment Share on other sites More sharing options...
adrian Posted October 7, 2013 Share Posted October 7, 2013 Is it possible that error is still there as a result of previous issues? I am wondering if the image is still in the field_images DB table, but not on the filesystem. I would try removing it from the database and see if that resets things. Link to comment Share on other sites More sharing options...
thomas Posted October 7, 2013 Author Share Posted October 7, 2013 Unfortunately no. I cleaned the image field before trying deleteAll() Link to comment Share on other sites More sharing options...
ryan Posted October 12, 2013 Share Posted October 12, 2013 I'm not aware of any bugs here, and I do these kinds of API replacement of images daily. But you might try and see if using the dev branch makes any difference here. Also it would be good to know of any modules you have installed in case anything is hooking into any of this. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now