How to set Path for "img src" tag?

Events happening in the community are now at Drupal community events on www.drupal.org.
gnanasekar's picture

Hi,

I Created one newsletter module. I want to display some images from files subfolders. How to set path for this image?. If anyone know , Please help me.

Thanks & Regards,
Gnanasekar Boju

Comments

Mimemail

parasolx's picture

If you used newsletter module alone, it will send plain text to the user. How ever you put any code it will translate into plain text and user will see the code. You need to use support plugin which name Mimemail Newsletter.

I already used in my website portal. But currently it still under development. Some bugs may occur if you used comment notify but you can solve by setting in mimemail setting by checked the option of "send all email in plain text". This option don't effect the newsletter sending mail.

Then just type your newsletter by putting all the img and this module will automatically convert in coding content type. Not plain text anymore. Adios.

Learn build website using Drupal in Malay language
http://www.kripkornstudios.com.my

Learn build website using Drupal in Malay language
http://www.kripkornstudios.com.my

this might be

balasky's picture

this might be usefull

$url_Path = "http://".$_SERVER['HTTP_HOST'].base_path()."/files/subfolders";

Try this

abcprabhu's picture

Try this variable

$path=$GLOBALS['base_url']."/files";

Why don't you try the simplenews & simplenews template modules. Which is very wonderful for newsletters.

Regards,
ABC

use this helper function

khanshakeeb's picture

use

drupal_get_path('module/theme')

for further defination viti: api.drupal.org

Solved: How to set Path for "img src" tag

elzix's picture

Solution:
If the path of your image is ://www.example.com/files/images/image.gif

$path = 'files/images/image.gif';
theme_image($path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE)

See also: http://api.drupal.org/api/function/theme_image/6

Example:

<?php
$result
= pager_query(db_rewrite_sql('
  SELECT * FROM {images}'
.
 
$filter['where'] .' ORDER BY image_id DESC'), 50, 0, NULL,
 
$filter['args']
);

while (
$node = db_fetch_object($result)) {
 
$nodes[$node->rating_id] = '';

 
$path = $node->image_path;
 
$form['symbol'][$node->image_id] = array(
   
'#value' => theme_image($path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE)
  );

 
$form['name'][$node->image_id] = array('#value' => t($node->image_name));
 
$form['descr'][$node->image_id] = array('#value' => t($node->image_descr));
}
?>

Drupal Developer Groups in Malaysia

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: