I'm testing this code and it seems to work, but it doesn't show an image but the code of the image.
I'm trying changing headers params with no luck, any idea?
really basic fault :)
You must put header('Content-type: image/jpeg'); at the very top of the file.
Related
I'm loading my images from a blob and I would like to load only the first page. I know this is possible with the [0] syntax when it is in a file but is there a way to do that without writing my image to the disk? Thanks
Try this....
with Image(blob=my_image_blob, format="PDF[0]") as img:
pass
Where "PDF[0]" is replaced with the correct decoder. Like "PS[0]", "GIF[0]". or 'TIFF[0]" as examples.
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 aroung 6k posts with images and now I need to link all them to the source image (to open them with pretty photo and make them "responsive") there are no custom fields with src links, simply html code with src.
Any suggestion in how to do it?
Thanks in advance!
You could use a javascript code that you embed in your template. This code looks for all images in the post content and modifies them as wanted. With jQuery something like that:
$("img").attr("src", function() {
return "/resources/" + this.title;
});
- taken from the jQuery Docs
The down-side of that is that this script has to run everytime the post is requested again. The alternative option would be to write a php script to replace all links in the database once. That is probably more effort at first but in my opinion worth it since its a one time job.
I'm looking for a way to have ALL of my single post pages (single.php) show the full size image regardless of the custom sizes i've posted for my home index page.
Amongst my many tries and fails i attempted this featured image solution but it didn't really work for my purposes.
http://voodoopress.com/2011/04/woking-with-featured-image-in-wordpress/
Is there a plugin for this that maybe I don't know about?
My PHP knowledge is limited to say the least.
Is there a php code that i can put into the single.php file to make this happen?
Any help is greatly appreciated .
Thanks.
You can pass a size parameter of 'full' to the the_post_thumbnail() function like this
<?php the_post_thumbnail('full'); ?>
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.