Robin S

Add Image URLs

Recommended Posts

An experimental module for adding images to a field via pasting one or more URLs.

Add Image URLs

Allows images to be added to an images field by pasting URLs.

image-urls

Usage

Install the Add Image URLs module.

A "Paste URLs" button will be added to all image fields. Use the button to show a textarea where image URLs may be pasted, one per line. Images are added when the page is saved.

 

https://github.com/Toutouwai/AddImageUrls

  • Like 19

Share this post


Link to post
Share on other sites

Really useful module I consider to be this one, I have done something similar on one website but was not as elegant as this one.

Thank you for your work.

  • Like 2

Share this post


Link to post
Share on other sites

nice :)

do you think you could extend this module to also store images pasted from the clipboard? 

PS: i think it would be great if the images were added via AJAX right after pasting (either urls or clipboard). what do you think @Robin S ?

  • Like 1

Share this post


Link to post
Share on other sites
5 hours ago, bernhard said:

do you think you could extend this module to also store images pasted from the clipboard?

I agree it would be handy, but that would be a completely different thing to what this module is doing. This module is essentially just using Pageimages::add() on the submitted URLs, and that method has no support for clipboard data. I don't think I want to disappear into the browser clipboard rabbit-hole with this module. :-)

5 hours ago, bernhard said:

i think it would be great if the images were added via AJAX right after pasting (either urls or clipboard).

I'll have a think about it. It would make the module significantly more complex and I'm not sure how much time I want to put into it. Maybe if I get bored sometime...

  • Like 3

Share this post


Link to post
Share on other sites

I'm getting an error on this...

Error: Uncaught TypeError: Argument 1 passed to ProcessWire\Pageimage::__construct() must be an instance of ProcessWire\Pagefiles, null given, called in /home/walking/public_html/site/modules/AddImageUrls/AddImageUrls.module on line 152 and defined in /home/walking/public_html/wire/core/Pageimage.php:109

Share this post


Link to post
Share on other sites
On 03/02/2018 at 1:30 PM, hezmann said:

I'm getting an error on this...

Can you give a more detailed report please?

  • What are the image URLs you are trying to add when you see the error notice?
  • Is the issue reproducible? i.e. if you try again with the same URLs do you see the same notice?
  • If you download the images to your computer and then upload as per a normal addition to an images field, do they work then?
  • Anything special about your images field - e.g. inside a Repeater or PageTable?
  • The error seems to be related to the field name. Could you please post a screenshot of your browser dev tools showing the source code of the textarea input that this module adds to the images field (like the one below)?

2018-02-05_101903.thumb.png.20073e94b74aaec6545dfec1222a2795.png

That will help me get to the bottom of this. Thanks.

 

Share this post


Link to post
Share on other sites

I've tried several URL's from various places - all get the same error

I get it with every URL so yes, reproducable.  I have not been able to save any images this way.

Saving the image and then uploading works fine.

Not inside a repeater or anything special, just a normal Images field

Full Error: image.thumb.png.fad8a91ee02bc55c323b1e2a18e494bc.png

 

Source Code

image.png.e5ff46b25d67dac405764089cc3b7c1c.png

  • Like 1

Share this post


Link to post
Share on other sites

@hezmann, if you can give me access to your dev site (send me a message) I would be happy to take a look. Otherwise I'm out of ideas sorry.

  • Like 1

Share this post


Link to post
Share on other sites

Hey @Robin S - I thought since I've been mucking about with a lot of modules and code I would do a clean install and see what happened.  I did a 100% clean install on a site that has literally never had anything on it (I owned the domain but have never used it).  Only added one field for images with one template.  Created a page and got this error:  image.thumb.png.b057755514b928016590e05782f264ac.png

I'll send you a message with login details to the new site.  Thanks!

  • Like 2

Share this post


Link to post
Share on other sites

v0.1.2 released - adds compatibility with PW < 3.0.66

  • Like 2

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By BitPoet
      MediaLibrary
      Update: MediaLibrary can now be found in the official module list.
      Out of necessity, I've started to implement a simple media library module.
      The basic mechanism is that it adds a MediaLibrary template with file and image fields. Pages of this type can be added anywhere in the page tree.
      The link and image pickers in CKEditor are extended to allow quick selection of library pages from dropdowns. In the link picker this happens in the MediaLibrary tab, where you can also see a preview of the selected image. In the image picker, simply select a library from the dropdown at the top, everything else is handled by standard functionality.
      I've put the code onto github. This module is compatible with ProcessWire 3.
      Steps to usage:
      Download the module's zip from github (switch to the pw3 branche beforehand if you want to test on PW 3.x) and unpack it into site/modules Click "Modules" -> "Refresh" in the admin Click "Install" for MediaLibrary For testing, create a page with the MediaLibrary template under home (give it an expressive title like 'Global Media') and add some images and files Edit a differnt page with a CKEditor field and add a link and an image to see the MediaLibrary features in action (see the screencap for details) Optionally, go into the module settings for MediaLibrary Note: this module is far from being as elaborate as Kongondo's Media Manager (and doesn't plan to be). If you need a feature-rich solution for integrated media management, give it a look.
      Feel free to change the settings for MediaFiles and MediaImages fields, just keep the type as multiple.
      There are some not-so-pretty hacks for creating and inserting the correct markup, which could probably be changed to use standard input fields, though I'm a bit at a loss right now how to get it to work. I've also still got to take a look at error handling before I can call it fit for production. All feedback and pointers are appreciated (that's also why I post this in the development section).

      Edit 09.03.2016 / version 0.0.4: there's now also a "Media" admin page with a shortcut to quickly add a new library.

      Edit 01.05.2016:
      Version 0.0.8:
      - The module now supports nested media libraries (all descendants of eligible media libraries are also selectable in link/image picker).
      - There's a MediaLibrary::getPageMediaLibraries method you can hook after to modify the array of available libraries.
      - You can switch between (default) select dropdowns or radio boxes in the module configuration of MediaLIbrary to choose libraries.
      Edit 10.10.2018:
      Version 0.1.3:
      - Dropped compatibility for ProcessWire legacy versions by adding namespaces
      - Allow deletion of libraries from the Media overview admin page
      - Added an option to hide media libraries from the page tree (optionally also for superusers)
    • By rolisx
      Hi all
      I have a problem here. I created a gallery with 240 pictures. Created an images field with no maximum amount (0). Unfortunately, only 98 of the 240 images show on the website. Any idea what I possibly could have done wrong? Thanks for your help!
      <?php foreach ($page->images as $image) { $options = array( 'quality' => 90, 'upscaling' => false ); $thumb = $image->size(250, 250, $options); ?> <div class="col-xl-2 col-lg-3 col-md-4 col-sm-6 col-6 foto"> <a href="<?= $image->url ?>" data-lightbox="lightbox" > <img src="<?= $thumb->url ?>" alt="" > </a> </div> <?php } ?>  
    • By Robin S
      This module corrects a few things that I find awkward about the "Add New Template" workflow in the PW admin. I opened a wishlist topic a while back because it would good to resolve some of these things in the core, but this module is a stopgap for now.
      Originally I was going to share these as a few standalone hooks, but decided to bundle them together in a configurable module instead.
      Add Template Enhancements
      A module for ProcessWire CMS/CMF. Adds some efficiency enhancements when adding or cloning templates via admin.

      Features
      Derive label from name when new template added: if you like to give each of your templates a label then this feature can save some time. The label can be added automatically when templates are added in admin, in admin/API, or not at all. There are options for underscore/hyphen replacement and capitalisation of the label. Edit template after add: when adding only a single template, the template is automatically opened for editing after it is added. Copy field contexts when cloning: this copies the field contexts (a.k.a. overrides such as column width, label and description) from the source template to the new template when using the "Duplicate/clone this template?" feature on the Advanced tab. Copy field contexts when duplicating fields: this copies the field contexts if you select the "Duplicate fields used by another template" option when adding a new template. Usage
      Install the Add Template Enhancements module.
      Configure the module settings according to what suits you.
       
      https://github.com/Toutouwai/AddTemplateEnhancements
      https://modules.processwire.com/modules/add-template-enhancements/
    • By Marco Angeli
      Hi there,
      I migrated my site from dev to live server. Copied all files in the new location, transferred MySQL db from dev to live.
      The site works properly, but the images not.
      Even the processwire logo in control panel is not visible: is it something related with files permissions?
      Is there an easy way to solve this issue?
      EDIT: if I update a page via control panel, adding a new image, the thumbnail is blank...
    • By Mike Rockett
      As I mentioned in this issue, I've create a new textformatter for ParsedownExtraPlugin, which adds some oomph to your markdown.
      Repo: Parsedown Extra Plugin
      Unlike the built-in textformatter for Parsedown and Parsedown Extra, this should be used when you want to use Extra with additional configuration/customisation.
      Some examples:
      ### Test {.heading} - A [external link](https://google.com/){.google} with `google` as a class that opens in a new tab if the config property is set. - [Another link](/page){target=_blank} that opens in a new tab even though it isn't external. ```html .html <p>Test</p> ``` There's some config options available to you, such as setting attributes on all/external images and links, setting table and table-cell alignment classes, adjusting footnote classes and IDs, adding <code> attributes to their parent <pre> elements, and changing the <code> class if your syntax highlighter does not use language-*.
      I was thinking about adding the ability to make links open in a new tab by appending a plus to the link syntax, but only external links should be opening in a new tab anyway. Further, this would add extra, unnecessary processing time.
      Please let me know if you bump into any problems. ☺️