So the Drupal 7 version is not working, at all.
And because I needed it on my sites. I port it to D7. So I got a working drupal 7 version. It's rough and in many part need improvement, I even disabled the ajax preview part. But at least it's working on the minimum function. Anyone need it, give a howl. Thanks

Comments

adf1969’s picture

I could use the D7 port.

I downloaded the latest "HEAD" version from CVS and it has a number of D7 issues in it (file_directory_path() instead of file_default_scheme(); drupal_function_exists() instead of function_exists(); PREG_CLASS_PUNCTUATION defined twice...)

It doesn't work (as you said)...but not sure where the "working" version is.

Thanks.

bjuncosa’s picture

I too noticed that the D7 version is hardly a D7 version at all. If there is a working version, where do we get it!?

arpeggio’s picture

I noticed that the last update of D7 version was last July 2010, that time Drupal 7 was undergoing so many changes and would now possibly not working on the current release of Drupal 7.

bjuncosa’s picture

I really want to see this move forward, and after looking at the code a bit closer it appears there was very little attention to porting this to D7. I'm not really sure what the proper protocol for this is, but I have started the process of porting this to D7 myself. It is currently not working, but it does install (the D7 module won't even install because of improper function calls). I plan on making quick progress on this as I want to use it on a project that I am currently working on. I will post here once it is stable (or at least in alpha / beta).

You can follow progress on GitHub: https://github.com/bjunc/Textimage

If anyone is familiar with git / GitHub and would like to contribute, hit me up and I'll add you as a contributor.

I apologize if I am stepping on toes by doing this. If there is a more appropriate process to follow, please let me know and I'll migrate accordingly.

By the way, I'll update version info, comments, module info, etc. as I move through the code. Currently, the documentation is for the 6.x version, so if you're looking at the code, don't put too much faith in instructions / documentation.

arpeggio’s picture

@bjuncosa you’re making a good step. I’m about to start working on D7 version of this module, maybe we could collaborate.

bjuncosa’s picture

Are you familiar with git / GitHub? I can add you as a collaborator on the project.

arpeggio’s picture

I have little knowledge of git/GitHub, as a module maintainer I have to learn git (by tomorrow Drupal will migrate from cvs to git). My GitHub username is kapitbisig.

sylv3st3r’s picture

StatusFileSize
new91.03 KB

I have a working D7 version. If you want to start from my version, it's a bit customized for my site.
The preview is not working, flush too and many errors on settings. But it's enough for my site. At least it's printing the image and saving in to a file.
I made a function to flush all images : textimage_clear_all_image()
To call it the textimage :

$variables=array(

        'preset' => $preset_name,

        'text' => $text,

        'format' => 'png',

        'alt' => $alt,

        'title' => $title,

);

$title=theme('textimage_image',$variables);
bjuncosa’s picture

@arpeggio:

I added you as a collaborator on the Textimage project. This allows you as a GitHub user to push / pull into GitHub hosted git repositories (not really a git thing as much as it is a GitHub permissions thing). You now have the ability to clone (do an initial pull of the project locally), make code changes, make commits, and push those changes back up to GitHub for me (or any other collaborator) to pull. If we are working closely together, then it is critical that you push your changes back up at stable points so that we are both working on the most up-to-date code, and that one person's changes don't break another person's progress. Especially because we will likely be working on the same files which will require merges (.module and .inc files primarily). One idea is that we only work on one function at a time. Once that function call (or hook in this case) is migrated to D7, we push back up to GitHub. I commented out a lot of the preset logic to get the module to install and run. Slowly, I planned on bringing it all back. I'll probably work on this a bit today. When in-doubt, do a pull. If you have any questions, I'm happy to help.

GitHub has a lot of instructions on how to get started with git. Here is a starting point:
http://help.github.com/

Also, if you are on a Mac, there is a GUI for doing git commits and diffs. It's called GitX. It's not a replacement for your terminal / command line, but it's nice anyway.

bjuncosa’s picture

Thanks sylv3st3r, maybe we can fold your working logic into the one on GitHub to create a fully functional version!? If you have a GitHub account, I can add you as a collaborator.

bjuncosa’s picture

I added a lot of sylv3st3r's code into the GitHub repo. There is still a lot to do, but it installs, saves and retrieves the images. Good start!

arpeggio’s picture

@bjuncosa thank you for adding me and for the quick instructions. I’ll familiarize myself first to GitHub. Looking forward that we complete porting this module to D7 soon. Thanks.

sylv3st3r’s picture

@bjuncosa : Yeah I have one, https://github.com/sylv3st3r (or just created one :P)
I would love to explain the file handling logic there. And some others that need to be changed because of Drupal 7. I just not really remember the original one :p Sorry. I ported this module 3 months ago. So if you stumble upon confusing things. Give me a howl

arpeggio’s picture

I made a good progress and already commit and push the code at https://github.com/bjunc/Textimage. Here are the summary of my progress:
- Moved the configure Textimage preset base path from admin/config/textimage to admin/config/media/textimage so it joins "Media" group of modules.
- Fixed and test each item's functionality and verification call back in admin page. Admin page is now functional.
- Added $file_path argument at textimage_build_image() function in able to have option to alter the destination path of the text image file.
- Fixed the theme_textimage_image() function and it can be called (the 'additional_text' is still not functional):

 theme('textimage_image', array(
  'preset' => 'Preset', 
  'text'   => 'Text', 
  'additional_text' => array('Additional', 'Text'), 
  'format'    => 'png', 
  'file_path' => 'public://myimages/sub_folder/image-filename'
 ));

- Replaced _textimage_recursive_delete() with Drupal native function file_unmanaged_delete_recursive().
- Made minor cleaned up (the textimage.install, textimage.module, textimage.utils.inc and textimage.admin.inc) conforming to Drupal coding standard.
- Corrected usage of theme_textimage_image() in README.txt
- Added center alignment support in text wrapping.

arpeggio’s picture

@bjuncosa I downloaded the original code created by the maintainer and compared to our code at https://github.com/bjunc/Textimage. I noticed few discrepancies like the textimage.utils.inc (this file does not exist in maintainer's original code) and the "Preview Textimage" part at admin page was removed in our code. Where did you based our code at https://github.com/bjunc/Textimage?

arpeggio’s picture

Made another push at https://github.com/bjunc/Textimage. Here are the summary:
- Fixed the Preview Textimage AJAX functionality at admin page.
- Fixed some hardcodes at textimage_build_preview() and file sytem scheme 'public'.
- Added image format argument at textimage_save_image().

arpeggio’s picture

Made another push at https://github.com/bjunc/Textimage. Here are the summary:
- Fixed textimage background's blending process.
- Fixed ajax preview of textimage background at admin page.

bjuncosa’s picture

@arpeggio:

That's great that you not only up and running with git, but you've already made a lot of progress! It looks as though your git configuration is not synced up with your GitHub profile though. If you have your git config (per repo or global) email address matching the email address for your GitHub account, then your commits should match up (I believe this is the same way the new Drupal.org system will associate your Drupal account with your local git config). Either way, awesome that you're up and running.

To answer your question, I created a new utils.inc file to separate out the utility functions. We can always fold them back in, but I liked the idea of treating the files almost as classes.

Other than that, the code is a mix between the official Textimage module pages' "D7" release, sylv3st3r's version and my own changes. And now yours!

I have looked a bit into the new git based Drupal.org. Once this module is fully functional, we might want to think about migrating the code to the new Drupal.org (it seems as though it is still in beta?).

I won't be able to get back at this for another day or two. If anything jumps out at you, let me know and I'll try to get on it.

arpeggio’s picture

My git global config is based on Drupal suggested setup and my account in GitHub is different with my Drupal account. I guess there's no way to setup two different profile config in one PC.

That's a good idea to separate helper functions to another file. However, I found some functions that in my opinion should be in admin.inc like the element validate handlers (I already moved those functions to admin.inc).

Made another push at https://github.com/bjunc/Textimage. Here are the summary:
- Moved the preview button beside the submit button of admin page.
- Fixed preview to work even if the browser does not support/disabled javascript.
- Fixed textimage preset formatter theme callback.
- Fixed caching for defined "file_path".

bjuncosa’s picture

@arpeggio:
You can have a global config, and per-repo configs. Although, as long as you are using the same email address for Drupal and GitHub, everything should sync up.

@sylv3st3r:
Sorry, I missed that you had signed up for GitHub. I've added you as a collaborator. You should be able to push & pull to the GitHub repository. Now that there are three collaborators, it's important to remember to push when the code is stable (at least relatively), and pull regularly. There is a higher likely that we could all make changes to the same files which will require code merges.

sylv3st3r’s picture

Thats... a lot of progress. I just successfully connected my git account with drupal account. Sorry for the delay. I'll help as I can

arpeggio’s picture

Made another push at https://github.com/bjunc/Textimage. Here are the summary:
- Added clear cache for individual image cached.
- Added textimage url derivatives.

adeb’s picture

Thanks a lot for the effort, works flawless

davery’s picture

I put in code to add a lineheight option.

Here are the diffs using the latest download from github.

/sites/all/modules/textimage$ for i in ./*; do echo $i && diff --normal ../bjunc-Textimage-60f9041/$i ./$i; done
./backgrounds
./CHANGELOG.txt
./fonts
./LICENSE.txt
./misc
Common subdirectories: ../bjunc-Textimage-60f9041/./misc/css and ././misc/css
Common subdirectories: ../bjunc-Textimage-60f9041/./misc/images and ././misc/images
./po
./README.txt
./textimage.admin.inc
201a202,214
> $form['settings']['font']['lineheight'] = array(
> '#type' => 'textfield',
> '#title' => t('Lineheight'),
> '#field_suffix' => t('%'),
> '#description' => t('Enter the lineheight as a percentage of the font size, e.g. "150%".'),
> '#default_value' => isset($preset['settings']['font']['lineheight'])
> ? $preset['settings']['font']['lineheight']
> : 150,
> '#maxlength' => 5,
> '#size' => 3,
> '#required' => TRUE,
> '#element_validate' => array('_textimage_number_validate'),
> );
832c845
< }
\ No newline at end of file
---
> }
./textimage.info
./textimage.install
./textimage.module
456c456
< $img = textimage_text_to_image($text, $font_size, $font_file, $font_color, $text_angle, $text_maximum_width, $text_fixed_width, $text_align);
---
> $img = textimage_text_to_image($text, $font_size, $font_lineheight, $font_file, $font_color, $text_angle, $text_maximum_width, $text_fixed_width, $text_align);
773c773
< }
\ No newline at end of file
---
> }
./textimage.utils.inc
14c14
< function textimage_text_to_image($text, $fontsize, $font, $color = array('hex' => '#000000', 'opacity' => '100'), $angle = 0, $maximum_width = 0, $fixed_width = 0, $align = ALIGN_LEFT){
---
> function textimage_text_to_image($text, $fontsize, $lineheight, $font, $color = array('hex' => '#000000', 'opacity' => '100'), $angle = 0, $maximum_width = 0, $fixed_width = 0, $align = ALIGN_LEFT){
109c109
< imagettftext($image, $fontsize, $q_angle, $x, $y, $fore, $font, $text);
---
> imagettfmultilinetext($image, $fontsize, $q_angle, $x, $y, $fore, $font, $text, $lineheight/100);
119a120,133
>
> /*this function does the line height adjustments. */
>
> function imagettfmultilinetext($image, $size, $angle, $x, $y, $color, $fontfile, $text, $spacing=1)
> {
> $lines=explode("\n",$text);
> for($i=0; $i< count($lines); $i++)
> {
> $newY=$y+($i * $size * $spacing);
> imagettftext($image, $size, $angle, $x, $newY, $color, $fontfile, $lines[$i]);
> }
> return null;
> }
>
412c426
< }
\ No newline at end of file
---
> }

bartk’s picture

Just a suggestion. It might be a good idea to fork this module off with a new (but similar) name, and then if the original author decides to merge the changes back in, close the fork and redirect people back here. As a D7 user, it would be nice if this were an official module.

rogical’s picture

+1
I'm planning to make a text2image field in D7, which will format the output of the text into a image.

This feature would be used on phone field, you may only want to display the phone while not allowed copied or read by spider.

Is it possilbe to add this feauture to this module?

Anonymous’s picture

I downloaded and enabled TextImage, only to find my server throwing 500 errors at me. The error message was as follows:

PHP Fatal error: Call to undefined function ctools_export_load_object() in /....../textimage.module on line 773

I managed to solve this problem by adding ctools_include('export'); on the line before the problematic line. I was using the latest version directly from GitHub.

Also, having the private files method enabled makes sure you can't see your images. Enabling public files solves this.

wundo’s picture

@ivolution, which version did you download? the one from d.o or github?

wundo’s picture

Status: Active » Fixed

I've merged the github repo to our d.o repo and released TextImage 7.x-2.0-alpha1 :)

http://drupal.org/node/1273150

rogical’s picture

Version: 7.x-2.x-dev » 7.x-2.0-alpha1
Status: Fixed » Active


Fatal error: Call to undefined function ctools_export_load_object() in /opt/difang/dev/pjkaixin/sites/all/modules/textimage/textimage.module on line 773

the error still exists, and my site crashed!, admin/config, admin/module .. the admin path are unable to work now.

rogical’s picture

StatusFileSize
new44.44 KB
new16.15 KB

can't find the 'present' in the field formatter/display.

wundo’s picture

Status: Active » Fixed

rlogica, please create a new issue for this bug.

Status: Fixed » Closed (fixed)

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