I've tried to generate images through urls but no image is served. Using the theme function, it works fine.

First thing I noticed is that in textimage_image(), the first argument is empty because the used regexp does not strip the first "/", so when explode() is called, the first argument is empty.

But it does not work either when testing with (line 269) :

$args    = explode('/', 'my_preset/test.png');

I tried several debug hacks but did not find any clue.

CommentFileSizeAuthor
#3 1273760-3-fix_url_creation.patch4.63 KBmondrake

Comments

jide’s picture

BTW, the README file says :

3. via URL:

Create an image with the URL in following format:
/[files directory]/textimages/[Preset](/Additional/Text)/[Text].[extension]

Although "textimages" should be singular.

mondrake’s picture

I've the same issue. I did a small change to code, adding the following below line 718 of the alpha1 version

else {
$arr = explode('.', $image['filename']);
$text = $arr[0];
$format = str_replace('image/', '', $image['filemime']);
$uri = preg_replace('/(.' . $format . '$)/', '', $image['uri']);
// Try to create new textimage from defined 'text'
return textimage_build_image('theme',
$variables['preset'],
$text,
!empty($variables['additional_text']) ? $variables['additional_text'] : array(),
$format,
$uri
);
}

However extension is not optional and won't take /Additional/Text in consideration, so it only works like

/[files directory]/textimage/[Preset]/[Text].png

This is enough to get the image but I guess more proper review is needed

mondrake’s picture

StatusFileSize
new4.63 KB

Hi, I investigated a bit further as I need url generation.

Apparently the url generation is processed via the textimage_deliver() function, and not via textimage_image(). I changed textimage_deliver so to take into account full uri (rather than just last two arguments as they would be passed via the callback) + added some defaults for formats in case missing. Now it works for me even with additional text so that original specs are supported. I commented out the callback to textimage_image() in textimage_menu() as it seems not called anymore.

/[files directory]/textimage/[Preset](/Additional/Text)/[Text].[extension]

Hopefully I could keep aligned with originally meant behaviour.

I am a newbie to Git, I tried to put it all in the patch attached.

mondrake’s picture

Status: Active » Needs review

Forgot to update status

wundo’s picture

Status: Needs review » Needs work

Hi mondrake,
Could you explain why you commented out this?

+// $items[file_build_uri('/textimage')] = array(^M
+// 'page callback' => 'textimage_image',^M
+// 'access arguments' => array('access content'),^M
+// 'type' => MENU_CALLBACK,^M
+// );^M
+//^M

mondrake’s picture

Hi wundo,

see my comment in #3. it seemed to me that textimage_image() is orphaned in favour of textimage_deliver(). Let me say that I started using textimage with versiion 7, so I have no knowledge about the 'history' of various layers of development, and that I need it mostly for url direct generation, so I may be missing some integration features here.

mondrake

mondrake’s picture

Status: Needs work » Needs review

status change

mondrake’s picture

Status: Needs review » Fixed

Fixed in 7.x-2.x-dev

Status: Fixed » Closed (fixed)

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