Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PROBLEM images and css have text/html content type
#1
just adding some social integration to my old GS site and noticed that tumblr integration wasn't working. when i try to add any image from my site to tumblr, it rejects the image, claiming it's not an image format it recognises (it's a jpeg, which appears in the browser fine). checking the header responses with curl -I shows all files (css, html, php, jpg, png) as having Content-Type: text/html; charset=utf-8.

Trying to add mime types to htaccess or whatever doesn't work, so i'm guessing it's either a getsimple failure or a webserver config fail. since it shared hosting i've no hope of getting anything changed there, so hoped someone here might know of a workaround or fix - thanks
Reply
#2
You can try an htaccess file your webserver handled mime types also chekc cpanel
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#3
(2017-04-05, 22:41:25)shawn_a Wrote: You can try an htaccess file your webserver handled mime types also chekc cpanel

As i said above - i've tried adding the filetype via htaccess. this is a shared host so no control over anything - no cpanel. this is a strange one - if i use php routines to check the mime type of a file on the server, they correctly find it to be image/jpeg. if i view resources in firefox images are identified as image, but if i curl or wget them, they report the content-type as Content-Type: text/html; charset=utf-8

Even if i use php to write out an image with

<?php
// Create a blank image and add some text
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  'A Simple Text String', $text_color);

// Set the content type header - in this case image/jpeg
header('Content-Type: image/jpeg');

// Output the image
imagejpeg($im);

// Free up memory
imagedestroy($im);
?>


if i wget this php it shows as text/html

very annoying, but i'm only guessing this is the issue with tumblr. certainly images from other peoples' sites have no issues...
Reply
#4
Actually just tried editing the header in the above image function.

if i change the function to set the image header to 'header('Content-Type: image/gif');' the image shows in a browser, but wget reports headers as text/html

if i change the function to set the image header to 'header('Content-Type: text/css');'  a browser shows the raw image data, but wget reports headers as text/html

so a browser is seeing the change in header, but wget is not. so it may be something to do with how tumblr checks the remote image type. or it may just be my site...
Reply
#5
Post your htacces
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#6
Just tried viewing the header via http://www.rexswain.com/httpview.html and the headers are seemingly correct. content-type certainly is. very strange. user agent maybe? anyway...

i'll try to redact my haccess and post here, but i've tried this with a sister site (on the same host) with no htaccess of any kind, and same results - tumblr doesn't accept the image. wish it was a little less obscure...but thanks for your efforts.
Reply
#7
I missed the part where you are streaming the image from php

Yeah you will have to get your php headers proper and maybe content length
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply




Users browsing this thread: 1 Guest(s)