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.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 1273760-3-fix_url_creation.patch | 4.63 KB | mondrake |
Comments
Comment #1
jide commentedBTW, the README file says :
Although "textimages" should be singular.
Comment #2
mondrakeI'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
Comment #3
mondrakeHi, 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.
Comment #4
mondrakeForgot to update status
Comment #5
wundo commentedHi 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
Comment #6
mondrakeHi 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
Comment #7
mondrakestatus change
Comment #8
mondrakeFixed in 7.x-2.x-dev