I'm working on a small web portal project and I want to customize one splash screen image but I'm not allowed to change the code of the web portal.
So the code is linked to image.jpg
Does it is possible to have a random image with .htaccess?
Something like that:
When the webportal is calling for image.jpg redirect randomly to image1.jpg, image2.jpg ... until image5.jpg
Kind regards,
steph!
What about linking the src of the image to a php script instead ? (if you are working with php)
like ,
<img src="path/myimage.php" />
select a random image file , set the right headers with header() , use file_get_content(imagepath) , and output the string with die($myimagestring) in a php file if you use php.
i dont think you could do that only with an htaccess.
Related
I'm using the vue-markdown package to render markdown. It seems to work except the images don't display. The file path is correct as I can have an img show up correctly
<img src="#/assets/7801_4_lang_image.png"><!-- shows up -->
<vue-markdown>![img](#/assets/7801_4_lang_image.PNG)</vue-markdown><!-- doesn't show up -->
Changing the # to .. doesn't change anything either, the top one displays but the bottom one doesn't. The case of png/PNG also doesn't matter. Am I referencing the image wrong?
The file loader doesn't know about images in Markdown so Webpack doesn't know to bundle them.
Typically you need to require() the image source (see https://cli.vuejs.org/guide/html-and-static-assets.html#relative-path-imports)
You could try this but I'm not entirely sure if it will work with the vue-markdown component.
![img]({{ require('#/assets/7801_4_lang_image.PNG') }})
To use the source prop, you would use something like
<vue-markdown :source="`![img](${require('#/assets/7801_4_lang_image.PNG')})`">
See https://v2.vuejs.org/v2/guide/syntax.html#Attributes
You could also use the public folder who's contents are always bundled. For example, for a file public/images/7801_4_lang_image.PNG and assuming your app runs at the domain root
![img](/images/7801_4_lang_image.PNG)
I have the following codes to test the image_style_url() on the latest drupal(v7.59)
<img src=“<?= file_create_url($fileuri); ?>” />
<img src=“<?= image_style_url(“medium”, $fileuri); ?>” />
The file_create_url() can show the original image properly, and the image_style_url() can only give the styled image url, but not creating any styled image in the styled image folder.
the public:// and the /tmp directriea are in 777 permission setting, so it won’t be related to permission problem.
Can someone tell me what is wrong with my drupal?
Seems you have to create the image derivate first. Normally this happens automatically when uploading an image via an image field upload. But the automatic derivate creating might simply get skipped on file field uploads, or when using some other image which isn't managed by Drupal at all, or when you added an image style after you already uploaded the image.
Have a look at image_style_create_derivative($style, $source, $destination). Check out the comments as well as $style needs to be an array returned by image_style_load('MYSTYLE').
Creates a new image derivative based on an image style.
Only issue left open is how to check first if the derivate already exists before calling that function. Maybe you can check what file_exists(image_style_path($style_name, $file_uri)) returns, first.
Read more: https://drupal.stackexchange.com/a/22555/15055
Nothing wrong with your Drupal. Derivative image is not physically created until someone visits the listing where that style is used.
Example: You create new node and upload an image on it. Original image is within files folder. But if you use for example teaser image style and if you go to teaser folder the image is not created there until someone visits the page where "teaser" image style is used. You can easily test this on clean Drupal. Basically the image is created on the fly on HTTP request.
I have seen many themes or scripts in which people use dummy images in places of image as shown in here :-
Dummy Image
and when i check its url , its like data:image/64 svg image something like this format , so how to create such images for our project?
I want offline method to get such images which can work offline aswell.
I searched alot for the solution but unable to find any solution for it so far , i got the php gd method but i wanted to know how it can be done as data:image method
try : lorempixel
if you want a 500 x 500 image
<img src="http://lorempixel.com/500/500" />
you can even specify the theme like :
<img src="http://lorempixel.com/500/500/nature" />
Base 64 svg seems to be some kind of format that optimizes your images. You can read about it here:
Base64 - Wikipedia
And you can use the following website to optimize your images with the Base64 encoding:
b64.io
I have changed my joomla! application to run at / (root) instead of /joomla/ by:
./bnconfig --appurl /
Everything works fine, except a Random Image Module, which no longer displays images.
Checking the html source, the link of the pictures looks like:
//folders/filename.jpg
which seems to be wrong.
Any hints how to influence that the src in the html is:
/folders/filename.jpg
like in case of other simple pictures displayed correctly.
Thanks in advance!
It looks like that changing the path of the pictures from absolute:
/opt/joomla-3.6.2-1/apps/joomla/htdocs/images/thumbnails
to relative
images/thumbnails
solves the issue.
I want to put a image into a post, but it seems I just cannot get it work.
For example, this one:
http://stockcharts.com/c-sc/sc?s=ACHN&p=D&b=5&g=0&i=t88400486500&r=9913
The output is a PNG file. So in HTML tab, i put,
< img src="http://stockcharts.com/c-sc/sc?s=ACHN&p=D&b=5&g=0&i=t88400486500&r=9913">,(I leave a empty space between the < and image otherwise, stackoverflow won't allow me to put a image tag here) it just won't show up the correct image. The image you will see is "go to stockcharts.com to view this chart", that is because the URL is wrong. If the URL is correct, the image will display fine. Any way to work around?
I was trying to play around with the formatting.php file, but so far, no luck.
(It is quite strange though, if you put the URL into your IE URL bar, and press enter, it shows up fine with a chart.)
Thanks.
Your URL is a web page, NOT an image. When you try to insert the link as an image, the html IMG tag is used to specify the FILE NAME to be inserted. The file can be on a different url but it should not refer to just another uri.
to get around it, you have 4 options:
Specify the image file name directly and not the uri with the img tag.
Use iframe and put the uri
use frame (I'd not go for this)
Use Ajax and fill it in a DIV tag - most effective in my opinion.