drupal - Adding images into blocks html -


I have added some HTML code in my block content and have enabled the full HTML filter.

I have used relative paths for my images, like "site / all / themes / zen / zen / image page"

I think this is not right because I need to change my path to the home page or "node / id" on page.

I think I can not use PHP inside the blocks, thus I can not use $ base_url ... how can I add the image to html only?

Thanks

The last answer provides a part of the solution, but here one Fuller scoop is:

Hand written HTML

If your site lives on example.com (i.e. this is the "root" site), then the front slash in your relative path Linking will solve the problem others have suggested:

  & lt; Img src = "/ sites / all / themes / zen / zen / image.png" & gt;  

However, if your site stays on example.com/my-drupal-site , then you have to type it in:

  & lt; Img src = "/ my-drupal-site / sites / all / themes / zen / zen / image.png" & gt;  

This is really better if you can use PHP to set the proper path. If you are calling a picture from a subject, you can use the Drupal function drupal_get_path to find the path like this:

  $ img_path = drupal_get_path ('Theme', 'zen'). '/zen/image.png';  

And then you can actually have Duplalie about this and use the theme_image function to create HTML for the image:

  $ img = theme ('image', $ img_path, 'my image - alt text', 'my image - title text');  $ img  now  & lt; Img & gt;  Html for  tags and its  src , see the API documentation for more information,  alt , and  title . 

Point-and-click solution

As Jeffremb says, your easiest bet is to use a combination of a WYSIWYG editor and create one of these files on all the details for you. In the file handling module named "IMCE" to shine, If you do not have access to the "PHP code" input format, this is the best solution.

  • Install IMCE module and IMCE WiSiVG bridge module, and enable IMCE button for your WYSIWYG editor in your configuration settings for available buttons. For a little more information on that setup process, read the documentation and make sure that the WYSIWYG module displays on its configuration page.

    Once you have installed and integrated IMCE with your WYSIWYG, when you click on the "Image" button in your WYSIWYG toolbar, your normal dialog should be displayed, but the IMCE file to open the browser A new small icon will appear. This file browser allows you to browse the folder for your files images or upload new files. It also supports an interval of image manipulation, and after selecting an image, will automatically generate the required HTML.


  • Comments

    Popular posts from this blog

    Eclipse CDT variable colors in editor -

    AJAX doesn't send POST query -

    wpf - Custom Message Box Advice -