Robin S Posted December 6, 2017 Share Posted December 6, 2017 Does anyone have any tips to share for moving an image from one image field to another on the same page in Page Edit? I know it can be done with the API but it seems like there should be some way via the admin interface. Like adding an image to an image field by pasting a URL - is that possible via the core or a module? Link to comment Share on other sites More sharing options...
dragan Posted December 6, 2017 Share Posted December 6, 2017 hmm, if you mean "moving" = moving image from image field A to B (and deleting the image from the source field A), I wouldn't know. But if you mean "moving" = duplicating an image from image field A to B (leaving the source image in source field A), then simply right-clicking on the source image, copy the image URL, and adding it that way would work. (at least with a really quick test on Chrome / Win) Not sure what the big picture in your scenario really is though... 1 Link to comment Share on other sites More sharing options...
Robin S Posted December 6, 2017 Author Share Posted December 6, 2017 1 minute ago, dragan said: right-clicking on the source image, copy the image URL, and adding it that way would work That would be fine, but how do you add an image to an image field via a URL? I feel like I've read something here in the forums about doing this but looking at the image field interface I can't see how it's possible. There is only the "Choose file" button for uploading an image and the drag-and-drop zone. Link to comment Share on other sites More sharing options...
adrian Posted December 6, 2017 Share Posted December 6, 2017 18 minutes ago, Robin S said: how do you add an image to an image field via a URL? Does this help? http://modules.processwire.com/modules/import-external-images/ I feel like it would be nice to also have the option to paste in a URL to an image directly into the images field as well though - maybe it could be extended? 2 Link to comment Share on other sites More sharing options...
Macrura Posted December 7, 2017 Share Posted December 7, 2017 the latest version also has an option to specify a field containing an image URL; this way you can copy image urls off the web, paste into that field and it adds it to the images field (specified in the module config); does the images field have a place to paste a URL - would that need to be added with a hook? Link to comment Share on other sites More sharing options...
adrian Posted December 7, 2017 Share Posted December 7, 2017 1 minute ago, Macrura said: does the images field have a place to paste a URL Not currently 2 minutes ago, Macrura said: would that need to be added with a hook? that was my thought of how to achieve it Link to comment Share on other sites More sharing options...
Macrura Posted December 7, 2017 Share Posted December 7, 2017 right - got it; i haven't pushed the new features to the import module yet, as still testing, will push it soon, maybe next week; i will look at how to add an input to the image, but adding input field to inputfield is something i've never tried yet... Link to comment Share on other sites More sharing options...
dragan Posted December 7, 2017 Share Posted December 7, 2017 14 hours ago, Robin S said: but how do you add an image to an image field via a URL? I feel like I've read something here in the forums about doing this but looking at the image field interface I can't see how it's possible. There is only the "Choose file" button for uploading an image and the drag-and-drop zone. Just click on "add new image", and paste the URL. 1 Link to comment Share on other sites More sharing options...
Robin S Posted December 8, 2017 Author Share Posted December 8, 2017 12 hours ago, dragan said: Just click on "add new image", and paste the URL. Thanks, I discovered this myself while I was experimenting yesterday, but it seems less than ideal for a couple of reasons. 1. When you do this, it seems that the image is first downloaded to your local disk, then uploaded to the site. This makes it unnecessarily slow for larger images or on slow connections. 2. The filename of the image is not preserved as per the original. On Windows Chrome at least, every filename gets "_1" appended to it. But on the positive side this approach does allow for client-side resizing. I had a go at a module that allows images to be added to a field via pasted URLs: I had a few concerns about the approach because the page and image field are identified by values that could potentially be manipulated client-side. But I've included some checks that hopefully mitigate this. Another niggle is that the API method $page->images_field->add() is surprisingly relaxed about what it will add to an images field. It doesn't seem to do any validation against the field settings or even disallow non-images from being added to an images field. So all the validation must be done independently (@Macrura, this might be something that affects your module too). I think I've accounted for most things, but if you guys will take a look and let me know if you spot any potential issues that would be great. Because the browser is not involved in the upload, no client-side resizing is possible but is done server-side instead (for max width/height settings). 2 Link to comment Share on other sites More sharing options...
kongondo Posted December 8, 2017 Share Posted December 8, 2017 (edited) 19 hours ago, dragan said: Just click on "add new image", and paste the URL I can't find this 'add new image'. Could you please post a screenshot? Thanks. Edited December 8, 2017 by kongondo Link to comment Share on other sites More sharing options...
gmclelland Posted January 5, 2018 Share Posted January 5, 2018 Me too. Please post a screenshot. Link to comment Share on other sites More sharing options...
Robin S Posted January 5, 2018 Author Share Posted January 5, 2018 @kongondo, @gmclelland, I think @dragan is referring to pasting the URL in the OS dialog you get after clicking "Choose file": 3 Link to comment Share on other sites More sharing options...
dragan Posted January 6, 2018 Share Posted January 6, 2018 yep 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