Page 1 of 1

No ALT text tag!

Posted: Sat 23. Oct 2004, 13:49
by Peekay
Love PHPWCMS, but I know we will be heavily criticised for not providing ALT text for images. Hope an ALT text field for the summary image and the Text with Image content-part finds it's way into next release. 8)

Posted: Sat 23. Oct 2004, 15:29
by cguenther
this hack adds an Alt- and Title-Text for Pictures.

Code: Select all

############################################################################################
## MOD Title:      phpWCMS ImageAlttext Mod
## MOD Author:     Johannes Meyknecht and Christian Günther for eMedia)Fabrik GbR
##                 (c) eMedia)Fabrik GbR 2004 | kontakt@emediafabrik.de
##
## Release Date:   2004-08-23
##
## License:        GPL
##				
## MOD Version:    MOD_phpwcms_ImageAlttext_v1.1
##
## Installation Level: Easy
## Installation Time:  5-10 Minutes
##
## Requirements:   phpwcms V1.1-RC4
##				   earlier versions should also work but not tested
##
## Files To Edit:  include/inc_front/front.func.inc.php
##
##
###########################################################################################
## For Security Purposes, Please Check http://www.emediafabrik.de/index.php
## for the latest version of this MOD. Downloading this MOD from other sites could cause 
## malicious code to enter into your phpwcms-installation.
##
## Changelog and further information can be found on our website.
###########################################################################################
## Before Adding This MOD To Your phpwcms, You Should Back Up All Files Related To This MOD
###########################################################################################


#
#-----[ OPEN ]------------------------------------------
#

include/inc_front/front.func.inc.php


#
#-----[ FIND ]------------------------------------------
#

	// insert non db image standard
	$search[7]		= '/\{IMAGE:(.*?):(.*?)\}|\{IMAGE:(.*?)\}/';
	$replace[7]		= '<img src="picture/$1$3" border="0" alt="$2" />';
	
	// insert non db image left
	$search[8]		= '/\{IMAGE_LEFT:(.*?)\}/';
	$replace[8]		= '<img src="picture/$1" border="0" align="left" alt="" />';
	
	// insert non db image right
	$search[9]		= '/\{IMAGE_RIGHT:(.*?)\}/';
	$replace[9]		= '<img src="picture/$1" border="0" align="right" alt="" />';
	
	// insert non db image center
	$search[10]		= '/\{IMAGE_CENTER:(.*?)\}/';
	$replace[10]		= '<div align="center"><img src="picture/$1" border="0" alt="" /></div>';



#
#-----[ REPLACE, WITH ]------------------------------------------
# 

	// insert non db image standard
	$search[7]		= '/\{IMAGE:(.*?):(.*?)\}|\{IMAGE:(.*?)\}/';
	$replace[7]		= '<img src="picture/$1$3" border="0" alt="$2" title="$2" />';
	
	// insert non db image left
	$search[8]		= '/\{IMAGE_LEFT:(.*?):(.*?)\}|\{IMAGE_LEFT:(.*?)\}/';
	$replace[8]		= '<img src="picture/$1$3" border="0" align="left" alt="$2" title="$2" />';
	
	// insert non db image right
	$search[9]		= '/\{IMAGE_RIGHT:(.*?):(.*?)\}|\{IMAGE_RIGHT:(.*?)\}/';
	$replace[9]		= '<img src="picture/$1$3" border="0" align="right" alt="$2" title="$2" />';
	
	// insert non db image center
	$search[10]		= '/\{IMAGE_CENTER:(.*?):(.*?)\}|\{IMAGE_CENTER:(.*?)\}/';
	$replace[10]		= '<div align="center"><img src="picture/$1$3" border="0" alt="$2" title="$2" /></div>';


#
#-----[ SAVE & CLOSE ]------------------------------------------
#

include/inc_front/front.func.inc.php


#
#-----[ USAGE ]------------------------------------------
#

{IMAGE:Path2Img}
{IMAGE:Path2Img:YourAlttext}


#
# EoM
check it out @ http://www.emediafabrik.de/index.php?de ... gealttext1

Posted: Sat 23. Oct 2004, 16:49
by Peekay
Nice hack for the replacement tag :D Many thanks for this cguenther.

I only spotted the problem when I checked my test site in Lynx. The navigation all worked well, but Lynx really needs ALT tags if the content is to make sense.

Would still like to see an additional ALT text field for users to complete when they add an image from the file centre to summaries and articles.