Hi, any idea if image import can be made to work with pathauto? Images are given the path /node/number if uploaded with image import until the image is edited then the path gets renamed.

CommentFileSizeAuthor
#1 image.patch425 bytesadrien.gibrat

Comments

adrien.gibrat’s picture

Component: image_import » image.module
Assigned: Unassigned » adrien.gibrat
Status: Active » Needs review
StatusFileSize
new425 bytes

The problem is in the image module, the function 'image_create_node_from' (that allow other modules to create image nodes) did not set $node->pathauto_perform_alias to TRUE, so the pathauto module do not create an alias...

The info of the image.module to apply the patch:

; $Id: image.info,v 1.2 2006/11/20 04:22:27 walkah Exp $
name = Image
description = Allows uploading, resizing and viewing of images.
package = Image

; Information added by drupal.org packaging script on 2008-02-17
version = "5.x-1.7"
project = "image"
datestamp = "1203217807"

The patch:

--- image.module.old	2008-03-22 23:39:50.000000000 +0100
+++ image.module	2008-03-22 23:38:03.000000000 +0100
@@ -1111,6 +1111,8 @@ function image_create_node_from($filepat
 
   // Save the node.
   $node = node_submit($node);
+  // Force pathauto alias for progammatically created image nodes
+  $node->pathauto_perform_alias = TRUE;
   node_save($node);
 
   // Remove the original image now that the import has completed.

drewish’s picture

i don't think that it's fair for the path auto module to assume that every other module is going to set it's flags for it. i'm very tempted to mark this as won't fix.

adrien.gibrat’s picture

It's the only way to generate an automatic path while importing... without changing too much things. Maybe an opt in option could allow user to choose either or not to generate a path, but I think all the programmatically created images should have an automatic path if pathauto is installed.

ggarry’s picture

Excellent thanks adrien!

Hetta’s picture

OK, that patch works on 5.x-2.x-dev.

sun’s picture

Version: 5.x-1.7 » 5.x-2.0-alpha3
Status: Needs review » Postponed (maintainer needs more info)

Is this still an issue? Did you update to the latest version?

sun’s picture

Title: Image Import and Pathauto? » No Pathauto URL alias generated for imported images
Version: 5.x-2.0-alpha3 » 6.x-1.0-alpha4
Component: image.module » image_import
Assigned: adrien.gibrat » Unassigned
Category: feature » bug
Status: Postponed (maintainer needs more info) » Active

It is.

Leeteq’s picture

Subscribing.

joachim’s picture

Status: Active » Postponed (maintainer needs more info)

Anyone tried this lately?

sun’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Sorry, without further information this issue can only be closed as not reproducible.

Feel free to re-open this issue if you want to provide further information. Thanks.