plainblack.com
Username Password
search
Bookmark and Share

TextImage Macro

The TextImage macro allows you to make an ASCII representation of any image in your asset tree. Not only is this a cool trick to impress your friends at parties, you can now also provide a new means of access to people still using textbrowsers lik lynx.

Installation:

Untar the archive and copy the TextImage.pm file into your <webgui-root>/lib/WebGUI/Macro directory. Enable the macro in your config file, restart your server and you are ready to use this fine piece of internet technology.

Usage:

Create a page or an article and put the macro in the Description field:

^TextImage;

The macro expects that you pass the url  of the image asset you want to Asciify as a formvar called aid. So if mysite.com/my/fine/image is the image in question and your macro is at the page mysite.com/textimage, use the following url:

http://mysite.com/textimage?aid=/my/fine/image 

Update:

I  adapted the Macro to work with the new API. If you're running a 6.99+ version of WebGUI be ure to grab the TextImage-1.0.0-WebGUI_6.99.tart.gz archive. If you are on lower versions use the other.

The 6.99+ version has been tested on WebGUI 7.2.3 only, therfore your mileage may vary on versions between 6.99 and 7.2.3. If it doesn't work, mail me or post a reply.

Changes:

A bug causing the macro to fail on windows systems has been fixed in 1.0.1 .

System RequirementsPlease be advised: this contribution was tested with something older than WebGUI 7.5. When this contribution was uploaded there was no field for the author to fill out regarding it's requirements.
Comments
3alafondo: "
Hi, Martin

Great macro! 

Could You tell me smth about compatibility of this macro with v.7.3.x? If it is not compatible, then are You planning to port?


Thanks .
"
3martink: "
Thanks. I just tested and no, it won't work on 7.3.x. Actually it will only work on 6.8.x and probably every release down to 6.3.x.

I will port it to 6.99+ though. Probably this weekend. 
"
4martink: "I ported the thing. Have fun playing with it. Let me know how it works for you."
3alafondo: "
Thanks!

I will test it tomorrow. 
"
3alafondo: "
Hi,

I have some troubles.

1) I create an article (path: http://www.mysite.com/gallery/textimage).

2) I have an image with path - http://www.mysite.com/uploads/z5/U4/b5U43koNKNHdjBdWlBS47Q/55-55-rrj.jpg

3) in progress: http://www.mysite.com/gallery/textimage?aid=/uploads/z5/U4/b5U43koNKNHdjBdWlBS47Q/55-55-rrj.jpg

4) the output - 







    Helaas pindakaas
"
3martink: "
You should not pass the path of the actual image (ie. not the url pointing in the uploads directory) but the url of the image asset.

Good luck,

Martin
 
"
3alafondo: "
Hi,

Here what I do and what I get:

1) path:

http://www.mysite.com/gallery/textimage?aid=/gallery/3-s1

(textImage path -  http://www.mysite.com/gallery/textimage ,

image asset path - http://www.mysite.com/gallery/3-s1)

 2) I get black vertical bar. 

 

html code:
<h2>TextImage</h2>
<pre style="font-size: 4pt; background: #000; text-color: #fff">
</pre>
</div> 

 
"
3martink: "
Strange. It works fine here...

Are you perhaps running WebGUI on a Windows box?

Martin


Edit: If you are indeed running on windows, chances are that version 1.0.1 does work.  
"
3alafondo: "
Hi,

No, I am running on *nix. Windows, IMHO, is not serious for production site.
"
3martink: "
Very strange,I've tried the macro on 7.3.2 and 7.3.11 and both worked fine. A black screen can occur if some css properties are not correct, but in the HTML the image should still show up.
Since I cannot reproduce the bug, I can only guess its cause.Are the (filesystem) permissions of the image correct?Can you view the image through its own url? Are there any errors in your webgui.log? Is the image committed? (This should not matter, but still...)Also, the image has been added with a filepile right? It should not be in a collaboration"
3alafondo: "
Hi,
Are the (filesystem) permissions of the image correct? - yes, permissions is correct
Can you view the image through its own url? - yes
Is the image committed? (This should not matter, but still...) - yes.Are there any errors in your webgui.log? - nothing!! I entered the wrong path to see what it writes - Here the log data:
2007/02/27 20:50:51 - WARN - www.mysitecom.conf - WebGUI::Session::ErrorHandler::warn[428] - The URL forums/3-s1 was requested, but does not exist in your asset tree. 

 

 
"
3martink: "
Ok, I need some debugging information then. To do this, I need  your help.

Could you put the following line:

[quote] return "[".$asset->get('className')."][$filet]";[/quote]

directly below this line:

[quote] my $filet = $asset->getStorageLocation->getPath($asset->get('filename'));[/quote]

After that please restart your server and post the result for the correct url? 
"
3alafondo: "
Hi,

Here is the textImage output (instead of black bar):

[WebGUI::Asset::File::Image][/siteengine/domains/mysite.com/www/public/uploads/4i/2n/4i2n8XF6zz8oOdCwG_gCMg/3-s1.jpg]

Log file data:

Nothing. 
"
3martink: "Those values are correct. You can remove the added line. Do you have an url where I can see the macro in action?"
3martink: "
Got the url. Tried the photo on my own site, and it just works. I have no idea other than that something must go wrong with image magick.

Could you please put this line:

[quote] return "[$width][".$image->Get('Width')."][".$image->Get('Height')."]";[/quote]


Directly behind the following block: 

[quote]        my $width;
        if ($image->Get('Width') > 400) {
                $width = 400;
        } else {
                $width = $image->Get('Width');
        }[/quote]
 


Restart the server and post the result.

Martin

"
3alafondo: "
result is 









    [267][267][400]
"
3alafondo: "If something wrong with ImageMagick, then it would not resize the images. I opened the gallery for"
3martink: "
I think I found the problem, which is related toi image magick after all. I think it has something to do with the 'quantum depth' with which image magick/perl magick has been compiled. Mine is (i guess) 16 bits, whereas yours is probably 32.

Anyway, in the process of finding this answer, I found a much better way to do this stuff anyway. 

I'll post the fix later tonight.

Martin

"
3alafondo: "
Yes, mine "quantum depth" is 32.

Waiting Your post. 
"
3alafondo: "I upload an image and pass it through textImage, I get a vertical black bar. the image size is less that"
DownloadTextImage-1.0.0.tar.gz TextImage-1.0.0.tar.gz
TextImage-1.0.1-WebGUI_6.99.tar.gz TextImage-1.0.1-WebGUI_6.99.tar.gz
LinksNo Support Offered
Statistics Downloads: 756
Views: 5824
Rating: 3
Updated: 2/27/2007
Keywords acme
NavigationBack to the Bazaar
© 2018 Plain Black Corporation | All Rights Reserved