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
Related
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.
INTRO
I have inventory mysql db I pull inventory records from with images. In most cases there is no image for the item so i use the following script to determine if a image exist and if not use a default image.
PROBLEM
Default img takes a while to load when the query results are 100 or more, i.e. 1500. I think this has more to do processing img errors vs loading the same default images. Maybe its processing time looking up all the images(I am inclined to believe it is both). NOTE - If I DO NOT include images - the text results load quickly.
Potential Solution
Page pagination - I prefer another work around
Disable img error reporting - Can I do this with jquery? or is this has to be done in php.
Use a script that does not require as much processing for the image. i.e looking up all the images at once ? - Maybe lazyload jquery plugin would solve this problem. FYI - My query results are displayed in an iframe.
SCRIPT I CURRENT USE
<div class='iimgd radius5'>
<img class='iimg radius5' src='../images/".$results['Description'].".jpg' onerror=\"this.src='../images/default.jpg'\"></div>
.
ANY THOUGHTS ARE APPRECIATED
Im using IMAGE CRUD to handle a images gallery, upload is correct, insert into table is correct but displaying thumnbails images is wrong, this is an example of the url for image thumbnails that IMAGE CRUD generates:
<img src="http://localhost/macoutlet/http://localhost/macoutlet/assets/uploads/thumb__http://localhost/macoutlet/http://localhost/macoutlet/assets/uploads/673d7-kim-kardashian-gingerly.jpg" class="basic-image" height="60" width="90">
Does anyone know the reason or how can fix this?
Dont know the reason, maybe because of htaccess rewrite or similar.
Fix: in file /application/libraries/image_crud.php around line 373 find this line:
$results[$num]->thumbnail_url = base_url().$this->image_path.'/'.$this->thumbnail_prefix.$row->{$this->url_field};
and replace with:
$thumbUrlBugFix = explode('/', $row->{$this->url_field});
$results[$num]->thumbnail_url = base_url().$this->image_path.'/'.$this->thumbnail_prefix.end($thumbUrlBugFix);
While creating and learning bootstrap page. I came across the content attribute of css I read few articles and I got how it works. But following code snippet shows me an image icon but the content attribute value really isn't the image url but a code. I'm not clear as how we can show the image without the url and where is the image coming from?
.test.glass i:before {
content: "\e001";
}
Following is the html element to show an image icon using above css:
<span class="test glass"><i></i></span>
But what is "\e001" is that an image code or something else?
they are utf8 codes. there are plenty of sites describing the glyphs for different standard fonts but you can also define your own font set with whatever images you choose as whatever character.
if you use a webfont, from fontello for example but are plenty of sites like that one, you can define what image to use as character \e0001 and whenever you want to use that image, you must make sure you use that font-face for the element and use the utf8 code to display the image. in html it would be someting like <span class="iconfont"></span>. if you add the image with css then is like in your example.
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.