The Image_import module allows you to set a title for each image. In this screen, It would be great to change the names of the image files to be uploaded into links. Give a link to the full image and allow to open it in a new browser window (target =_blank is a must otherwise the title of previously titled images is deleted when going back to the form).. It's much easier to give the image a name when looking at it's contents.

So here is a patch which adds the link

Amnon
-
Professional: Drupal Israel | Drupal Development & Consulting | Eco-Healing | Effective Hosting Strategies | בניית אתרים
Personal: Hitech Dolphin: Regain Simple Joy :)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

druvision’s picture

The following patch might be easier to apply (no change, except the file names).

drewish’s picture

Version: 5.x-2.x-dev » 6.x-1.x-dev

now that HEAD is open for 6 all features have to be added there and then back ported. i haven't tested if your patch would apply there, just making note of the workflow.

Hetta’s picture

Status: Needs review » Needs work

The patch applies, but breaks image import (latest 6.x-1.x-dev):

* Error importing /srv/www/htdocs/drupal6/sites/default/files/images/import/scutellaria-baicalensis-3.jpg.
* Error importing /srv/www/htdocs/drupal6/sites/default/files/images/import/scutellaria-baicalensis-4.jpg.
* Error importing /srv/www/htdocs/drupal6/sites/default/files/images/import/scutellaria-baicalensis-5.jpg.
* No image files were imported.

drewish’s picture

one problem with this approach is that the import directory may not be in a web server accessible location so we'd need to add a menu handler to catch the file request and serve up the file...

drewish’s picture

having a hook would allow other modules to implement things like this:
#184366: image_import with EXIF data

druvision’s picture

Title: image import - Preview links for easier title naming » image import - Show image thumbnails for easier title naming
Version: 6.x-1.x-dev » 5.x-1.8
FileSize
17.02 KB
1.03 KB

Here is a second patch which shows image thumbnails for easier title naming.
I am also attaching a capture of how it looks on my RTL site.

The patch is for Drupal 5.x - I think it's a better idea to show thumbnails instead of the links suggested before.

Amnon
-
Professional: Drupal Israel | Drupal Development & Consulting | Eco-Healing
Personal: Hitech Dolphin: Regain Simple Joy :)

nimzie’s picture

I tried out your solution and I'm getting thumbnails, but I am not getting any files to import. I've got several of them selected for import and all fields are filled out.

      if (!empty($nodes)) {
        drupal_set_message(t('Successfully imported: ') . theme('item_list', $nodes));
      }
      else {
        drupal_set_message(t('No image files were imported.'));
      }
 

appears to be getting hit and I am seeing the message (no image files were imported)...

So - here is my patched code. I'm not at the root of the machine so I have a call to base_path() added. The only difference.

        $basename=substr($file->filename, strlen($importdir) + 1);
        $imgRef = '<img width=40 src="' . base_path() . $file->filename . '" >';
        $filelist[] = str_replace('IMG', $imgRef, l('IMG', $importdir . '/' . $basename, array('target' => '_blank')));

... I'd love for this to work. What a great little solution and I've been having a hard time getting it working. A bit of a mod fix noobie...

Any help would be appreciated.

Cheers,
Adam

terryit3’s picture

I applied the patch from post #6 and the images are successfully showing up on the import page. The links to the image is built correctly.

My problem is the links aren't being built correctly to open the full image or import the full image.
The link to the image on the import page is linked like this: "http://files/images/import/Scan-081202-0001.jpg"

Obviously I need them to link to http://www.mysite.com/files/images/import/Scan-081202.jpg

Can anyone offer any help?

I also noticed that by using $basename=substr($file->filename, strlen($importdir) + 1); it would cut the first letter to my path off.. /iles/import instead of /files/import. Not sure why, but fixed it by removing the + 1

neoliminal’s picture

Can I suggest you use a height instead of width limit? This will keep row heights uniform and make a cleaner looking interface if all the images are different ratios.

neoliminal’s picture

My solution changed the form:

<?php
      $form['files']['dimensions'][$index] = array(
        '#type' => 'item',
        '#value' => $file->width .'x'. $file->height,
        '#suffix' => '<img src="'. base_path() . $file->filename . '" height="50px" />', //creates thumbnail for imported images before node creation
      );
?>
nimzie’s picture

did this bring up photo thumbnails? how/where did you implement this?

neoliminal’s picture

did this bring up photo thumbnails? how/where did you implement this?

Not sure if you're asking me, but the code I wrote above is in:
image_import.pages.inc for Drupal 6.

Line number 74-78...

Adding the line starting '#suffix' will put a thumbnail 50px high under the "height and width" column.

Hetta’s picture

A proper patch for comment # 6; this works nicely for 5.x-2.x-dev --- ah no, it doesn't. It shows thumbnails nicely, but doesn't actually import images.

Vendetta501’s picture

subscribing... is there any version of this for D6?

glass.dimly’s picture

Wow, this would sure be great for Drupal 6. This would make the image import module really really cool.

joachim’s picture

Version: 5.x-1.8 » 6.x-1.x-dev
Status: Needs work » Needs review
FileSize
1.5 KB

Changing the version: see comment #2.

And it's a two-liner patch. The right place to do this is in the theme function. (Which also means you can change the 40px width if you don't like it ;)

Looking at the list of commenters, I hope people will take the time to test this?

glass.dimly’s picture

I applied this patch to the dev version of Image and it works great. Thanks so much. This makes all the difference in the world to the image import module. I'll be running the patched version and will get back to this thread to let folks know how it goes.

You, with your two-line patch, are awesome!
-glass.dimly

joachim’s picture

Status: Needs review » Fixed

Thank you for testing!

Committed the patch -- I think one test is enough for such a small change :)

This will be available in the dev release shortly.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

patoshi’s picture

updated the D6 patch with a mouse over state. the image thumbnail feature is nice, but you couldnt really see the image too well if its fine detail and u had to give it a title. This solution solves the problem by hovering over to produce a larger image for viewing. Since inline styling doesnt support hover, had to use onmouseover states:

array('data' => 'Only local images are allowed.'),

would be more ux friendly if it would enlarge when filling in the title. maybe will have to do that next time.