Dynamic image path not working in drupal 7 - php

I tried giving the image path like
<img src="<?php print $directory; ?>/images/yourimage.gif" />
in Drupal 7.
But it's not working. The images are still not loading.
If I give the path like
its working.
I heard its not a good practice.
Is there any other way to add image source in drupal?

your question is not clear. Where did you put your image? Did you use custom content type to save your image? Did you used IMCE in a text field? Do you mean this image is in your template folder, and you call it in your html or page template?
Usually, an image is saved in a node content, customized by editing/creating a content type suitable to the data you want to show.

Related

Show an uploaded image using codeigniter

I have successfully uploaded an image in folder application/uploads codeigniter. When I'm trying to display the image in an <img> tag its not showing. I've checked the path is correct and the image does exist.
Just hit that image src link on browser and check whether image is displaying or not. You can upload your images in assets folder. Call your image by using url https://yoururl.com/assets/imgfolder/img.jpg . It should display. Hope this will help you.
Can you show us the tag you are using with the path. If you believe the path is correct, can you type this path straight into your browser and see the image displayed? You can do a 'view source' to get the path if you are using Codeigniter base_url or similar.
(sorry to post this as an answer but my rep isn't high enough to allow commenting)

How to show uploaded files in uploadcare?

I'm using uploadcare.com to store my images and files. I just started using it now. I was just wondering that how can i display the uploaded files in a web page. I looked through the documentation too. But didn't get anything to start with?
Is there anyone who have used it?
As per documentation, all images are available via CDN URL (this URL is returned by widget, it's up to you to save it). To add an image to your page just add an img tag:
<img src="http://www.ucarecdn.com/5651bbb6-c599-44bd-9c63-1db5e67db6ad/" />

How do I edit the html when using a PHP based CMS?

I am not experienced outside of HTML and CSS.
I have a site on a less well known CMS called Ushahidi. Editing CSS is fine but right now I need to change an img selection. Currently, an image on a page has the code:
<a class="photothumb" rel="lightbox-group1" href="http://trashswag.com/media/uploads/35_1_1347312096.jpg"><img src="http://trashswag.com/media/uploads/35_1_1347312096_t.jpg"></a>
I need to remove the ability of the site to use the second image (note there is a slight difference "_t.jpg" is appended to the second src.
How would I alter the site so as to select the first image only i.e. remove the "_t" string?
The version of the image with the _t in the name is probably a thumbnail of the first image. What you have there is a small image, that when clicked takes you to a larger image. If you want to display the full-sized image and get rid of the link, just use
<img src="http://trashswag.com/media/uploads/35_1_1347312096.jpg">

Drupal 7:replace original image with ImageStyles generated image

I'm using regular imagefields on various content types in a Drupal 7 social website (and also on the user profile pictures via http://drupal.org/project/imagecache_profiles). For cropping I'm using http://drupal.org/project/imagecrop as an image style effect.
I would like to replace the original image with the one generated from the imagecrop style. How do you replace the original image from a user (the one that gets used for subsequent image styles when you say call it in views) with one that is created from an image style effect?
I'm not sure the best way to approach this problem, which is why I posted question.
To make sure I'm being clear -
A User uploads a large image (say 2,000 pixels by 1300 pixels) via a regular imagefield.
Using image styles, I perform some effects (specifically javascript crop, but this could be generic) and then replace the original image with the one generated from the image style.
All additional image styles (different sizes etc) use the new original images and are derived from it.
I think this can be done easily using a custom module and they must have used something like the image editor project - See drupal.org/project/imageeditor, just not sure what hooks to use or how to jump in on this. Any advice, tips or direction would be great.
Check module - Original image with style
I believe you can address your problem by making changes under the display settings for your field:
/admin/structure/types/manage/[your content type machine name here]/display

ckeditor, php, image display issue

I have a download.php file to display images on a web page as well as downloading files like pdfs, docs, etc.
in ckeditor if the src for the image is /download.php it dispalys like there is no image or broken link image, if the src for the image is http://www.mydomain.com/download.php my image displays just fine in ckeditor.
Any thoughts? And no i cant just make it put the full domain. There is a reason to long, complicated, and stupid to explain thanks to the web hosting company.
In the configuration you need to set the baseHref to the full path, then it will add that to the images/files you upload and insert.

Categories