Jump to content

Recommended Posts

BETA: SplashAndGrab

https://github.com/madebymats/InputfieldSplashAndGrab

This module attaches a search input to selected image fields that lets you search and download images from Unsplash.
(Unsplash is a stock photo service where you can download images for free and use as you wish. No strings attached.)   
You can search by string, colors, orientation/crop and order by relevance or time published

I find Unsplash useful both for placeholder images when building sites but also as a time saver for editors if they don’t have any images at hand, just search, download and publish.

splashandgrab.thumb.jpg.c9ffce8944a65d35ffe1e53fe081209f.jpg

Thanks to @apeisa for building the  FlickrInputField Module and @Robin S for AddImageUrls,  took a lot ideas and code from those modules.

Edited by Mats
Added @'s and image
  • Like 15

Share this post


Link to post
Share on other sites
27 minutes ago, Mats said:

SplashAndGrab

Loving the name 😄 

A README?

  • Like 2

Share this post


Link to post
Share on other sites
28 minutes ago, kongondo said:

Loving the name 😄 

The name might be the best part of the module. 😅

A Readme is added.

  • Like 3

Share this post


Link to post
Share on other sites
On 6/12/2020 at 10:48 PM, Mats said:

Thanks to @apeisa for building the  FlickrInputField Module

Hah, I had forgotten this one.

SplashAndGrab looks (and sounds) great!

  • Like 2

Share this post


Link to post
Share on other sites
1 minute ago, Mats said:

Hi @bernhard! No, i haven't thought about that. 

= I have not thought about that, but it's a good idea and easy to implement.
= I have not thought about that and I'm not willing to add any other services.

? 😉 

  • Like 2

Share this post


Link to post
Share on other sites

Cool - i was building this, but i got stuck on the Unsplah api which was telling me they didn't like downloads and wanted to only allow usage that would use the source image from them, and this wouldn't work with an images inputfield, or imagesizer engine, or any other image manipulation like srcsets etc; So i gave up... Looks like somehow you solved all of this, so thanks!  Does this use a fixed api key, or will that api key need to be configurable at some point?

 

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, bernhard said:

= I have not thought about that, but it's a good idea and easy to implement.
= I have not thought about that and I'm not willing to add any other services.

= I have not thought about that and I don't  know how o add any other service.  😁 

2 hours ago, Macrura said:

Does this use a fixed api key, or will that api key need to be configurable at some point?

This uses a fixed api key. 

 

  • Like 2

Share this post


Link to post
Share on other sites

The 5000 hits limit resets hourly so I think it should be ok. 

  • Like 1

Share this post


Link to post
Share on other sites

Hi @Mats

thank you for this module!

I noticed an issue when trying to crop images which where downloaded via this module on saving. The error said that the image could not be found.

I assume this has to do with the page file name, which has a "." in its name, which seems to be a problem.

I replaced the renaming with following line, which solves this problem for me. Maybe it's helpful for someone else coming accross this.

$pagefile->rename(str_replace('.', '-', $pagefile) . ".jpg");

 

  • Like 3

Share this post


Link to post
Share on other sites

I have noticed that on pages where an image field with this feature is activated, I get a warning that the page is being edited in another window that is generally off by a few minutes. I was not seeing this issue at all prior to adding the module. The page saves without issue, but immediately after saving the warning will pop up sometimes.

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 Bike
      Hello everyone!
      I am new to PW and at this moment there are these issues that I cannot clearly understand:
      1) Image Position
      Previously I used TinyMCE and there I could get an image floating left or right by simply selecting it and pressing the text justify buttons from the menu bar. In CKEditor however it just causes the hole paragraphs content to be aligned which results in code like this and of course the image is not floating that way:
      <p class="xyz" style="text-align:right"><img alt="" src="someimage.jpg" width="1000" /></p> Q: Is it possible to add float to images just by clicking the text align buttons? As far as I figured it out the only way to align images is within the image dialouge which I find is pretty inconvenient.
      2) Image Caption / Figure / Figcaption
      When a title is given to an image it is wrapped inside a figure tag and a figcaption tag is applied. That's fine. But I need the image to be wrapped inside another picture tag for styling reasons (I want to add a shadow png with picture::after). I'd like to end up with this:
      <figure><picture><img alt="" src="someimage.jpg" width="1000" /></picture> <figcaption>Caption there</figcaption> </figure> Q: I think I have to modify the plugins code to achieve it, right? If so does anyone knows the file / location?
      Q: If a figure tag is placed how would I change its position say to another paragraph? Drag & drop just relocates the image leaving the figure tag where it was. How to reposition the whole thing?
      Q: How / where would I enter image description the be shown only in say a lightbox but not alongside the image itself? I thought the textarea provided in the image field could do the job but how to access it from the editor? Even possible?
      Well I hope someone understands and I'd be thankful for a clue of any of these questions.
      ✌️ Bike
       
    • By Marvin
      Hello, my name Marvin, i want to ask something. I'm new at processwire, and still learn it, i try yo showing an image, at a table, the image was show, but i can't resize the image
      please HELP
      Here i attach, my code belor
      <?php $num = 1; foreach($pages->get("/files/")->children as $child) { $current = $child === $page ? " class='current'" : ''; $result = $child->images; // $result->width(900); // $result->height(100); foreach($result as $items){ foreach($pages->get($child->name)->files as $file) { // $file = $child->files; // echo $file->name; echo "<tr><td>".$num++.".</td><td>".$child->title."</td><td>".$child->text_1."</td><td>".$child->text_2."</td><td>".$child->text_3."</td><td><a href='".$file->httpUrl."'>".$file->name."</a></td><td><img src='".$items->url."'></td></tr>"; } } } ?>  
    • By theoretic
      Hi there! And thanks for Processwire!
      It appears there's a possible bug in Processwire 3.0.170 concerning file and/or image inputfield. Creating such a field results in the following error:

      Fatal Error: Uncaught Error: Call to a member function get() on null
      The inputfield is created however. The closer look reveals a problem at line 60 in wire\modules\Fieldtype\FieldtypeFile\config.php:
      if(!$value) $value = $fieldtype->get('defaultFileExtensions'); Commenting this line removes the problem, but the newly created inputfield requires 'Allowed file extensions' config option to be set (which is rather expectable since i commented the above-cited line of code). Never faced this problem before, hope it can be resolved.
    • By picarica
      so this is really weird issue i am so confused about this, so i have setup 'images' field where i put images and the include them in CKeditor, should work right? well it works on some sites, i use it nearly in every page but at one page, the images included in that CKeditor only show up, when i am logged into processwire, when i turn on incognito mode the images dissapear, but only on this specific page, everywhere else it works perfectly, has anyone came across this issue? i have nowhere in the site login checker, i have no idea what is going on
    • By picarica
      so i am trying to fetch dimensions of image using getimagesize() but it returns nothing, at least i think so, i want to feed it to data attribute, bit its emtpy, i tried feeding it the image directly or just image->url
      here is my source code

       
      foreach($page->repeat_body as $r_body) { /* other code here*/ if ($r_body->gallery_check == 1) { echo "<div class='my-gallery' id='grid-gallery' itemscope itemtype='http://schema.org/ImageGallery'>"; foreach($r_body->image as $image) { $options = array('quality' => 80, 'upscaling' => true, 'cropping' => 'north', 'sharpening'=>'medium'); $thumb = $image->size(400, 400, $options); $large = $image->size(1280, 0, $options); list($width, $height) = getimagesize($image->url); echo " <figure itemprop='associatedMedia' itemscope itemtype='http://schema.org/ImageObject'> <a href='$large->url' itemprop='contentUrl' data-size='$widthx$height' data-index='0'> <img src='$thumb->url' height='$height' width='$width' itemprop='thumbnail' alt='Beach'> </a> </figure>"; } echo "</div>"; } /* other code here*/ } now, the images are outputted correctly, i can open then and browse them
×
×
  • Create New...