blob

Content-Security-Policy object-src blob

若如初见. 提交于 2019-12-01 13:42:30
问题 When using a content-security-policy and I try to follow a process in Chrome 41 (beta) using window.URL.createObjectURL I get an error like the following: Refused to load plugin data from 'blob:http%3A//localhost%3A7000/f59612b8-c760-43a4-98cd-fe2a44648393' because it violates the following Content Security Policy directive: "object-src blob://*" With a content security policy that restricts object-src or otherwise default-src one can reproduce the issue (with jQuery for convenience) like

Turn XMLhttpRequest into a function fails: asynchronity or other?

爱⌒轻易说出口 提交于 2019-12-01 13:15:41
问题 I try to turn an XMLHttpRequest into a function such var getImageBase64 = function (url) { // code function var xhr = new XMLHttpRequest(url); ... // code to load file ... // code to convert data to base64 return wanted_result; // return result of conversion } var newData = getImageBase64('http://fiddle.jshell.net/img/logo.png'); // function call doSomethingWithData($("#hook"), newData); // reinjecting newData in wanted place. I'am successful to load the file, and to convert to base64. I'am

Struggling to display blob image with php

你离开我真会死。 提交于 2019-12-01 12:18:51
问题 I am building a simple website, I want to allow the users to upload and change their avatars. At present I have been able to upload images to a mysql database, stored as blobs with the code as follows: //connected to DB, userID fetched $image = $FILES['fileToUpload']['tmp_name']; $fp = fopen($image, 'r'); $content = fread($fp, filesize($image)); $content = addslashes($content); fclose($fp); $sql = "UPDATE tbUsers SET profileImage = '".$content."' WHERE userID = ".userID; $result = mysql_query

how to play mp3 audio stored im mysql blob using php

家住魔仙堡 提交于 2019-12-01 12:15:17
I have stored small 100kb mp3 files in mysql db as blob using phpMyAdmin However i am unable to output it on html and play the audio...here is my code require ('mysqli_connect.php'); //contains database connection $sql="SELECT sound FROM english WHERE eWord LIKE '%" . $name . "%' OR kWord LIKE '%" . $name ."%'"; while($row=mysql_fetch_array($result)){ $sound=$row['sound']; echo '<audio controls>'; echo '<source src="data:audio/mp3;base64,'.$row['sound'].'">'; echo '</audio>'; What actually happens is that on loading the page in xampp localhost grayed out html audio player comes and doesn't

Hide Azure Blob Url

て烟熏妆下的殇ゞ 提交于 2019-12-01 12:03:38
I have a large amount of files stored in a public Azure blob container, all of which are referenced directly via the HTML in my ASP.NET MVC web application. As an example a path to one of the images in blob storage looks like so: //<my-storage-account-name>.blob.core.windows.net/public/logo.png I want to avoid displaying my storage account name in my HTML source code so rather than: <img src="//<my-storage-account-name>.blob.core.windows.net/public/logo.png"/> I'd prefer to use this: <img src="/images/logo.png"/> I want to avoid setting up an MVC route and using the blob API to load the file

mybatis 处理CLOB/BLOB类型数据

谁都会走 提交于 2019-12-01 11:59:12
BLOB和CLOB都是大字段类型。 BLOB是按二进制来存储的,而CLOB是可以直接存储文字的。 通常像图片、文件、音乐等信息就用BLOB字段来存储,先将文件转为二进制再存储进去。文章或者是较长的文字,就用CLOB存储. BLOB和CLOB在不同的数据库中对应的类型也不一样: MySQL 中:clob对应text/longtext,blob对应blob Oracle中:clob对应clob,blob对应blob MyBatis提供了内建的对CLOB/BLOB类型列的映射处理支持。 建表语句: create table user_pics( id number primary key, name varchar2(50) , pic blob, bio clob ); 照片(pic)可以是PNG,JPG或其他格式的。简介信息(bio)可以是学比较长的文字描述。默认情况下,MyBatis将CLOB类型的列映射到java.lang.String类型上、而把BLOB列映射到byte[]类型上。 public class UserPic{ private int id; private String name; private byte[] pic; private String bio; //setters & getters } 映射文件: <insert id=

Find file in directory with the highest number in the filename

情到浓时终转凉″ 提交于 2019-12-01 11:30:49
My question is closely related to Python identify file with largest number as part of filename I want to append files to a certain directory. The name of the files are: file1, file2......file^n. This works if i do it in one go, but when i want to add files again, and want to find the last file added (in this case the file with the highest number), it recognises 'file6' to be higher than 'file100'. How can i solve this. import glob import os latest_file = max(sorted(list_of_files, key=os.path.getctime)) print latest_file As you can see i tried looking at created time and i also tried looking at

PHP: Show JPG from Binary

一世执手 提交于 2019-12-01 11:15:32
问题 I have a jpg blob thats been stored in an external DB and I'm looking to display that as an image via php. The issue is whenever I set the Content-Type to image/jpeg and echo out the blob I get the broken image icon when browsing to it. I have tried making the file from scratch via sublime and that works when I save it as a hexadecimal file so I know the data is valid. I have tried making the script create a file but it sets the charset=us-ascii so it won't get seen as a image file. Does

pdo insert image into database directly - always inserting BLOB - 0B

给你一囗甜甜゛ 提交于 2019-12-01 11:03:23
I'm trying to insert the image into mysql database table directly. In my database I'm always getting [BLOB - 0B]. it doesn't insert images into table. I didn't get any error too. I'm confused.. PHP ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); include('config.php'); if (isset($_FILES['image']) && $_FILES['image']['size'] > 0) { $tmpName = $_FILES['image']['tmp_name']; $fp = fopen($tmpName, 'r'); $data = fread($fp, filesize($tmpName)); $data = addslashes($data); fclose($fp); } try { $stmt = $conn->prepare("INSERT INTO images ( picture ) VALUES ( '$data'

SAS Azure Signature did not match

孤人 提交于 2019-12-01 09:39:49
I try to create a SAS to a blob on azure storage in php. I write the following code: $key ="..."; $end = date('Y-m-d\TH\:i\:s\Z', strtotime('+1 day')); function getSASForBlob($accountName, $container, $blob, $permissions ,$expiry, $key){ /* Create the signature */ $_arraysign = array(); $_arraysign[] = $permissions; $_arraysign[] = ''; $_arraysign[] = $expiry; $_arraysign[] = '/'.$accountName . '/' . $container . '/' . $blob; $_arraysign[] = ''; $_arraysign[] = "2015-12-11"; //the API version is now required $_arraysign[] = ''; $_arraysign[] = ''; $_arraysign[] = ''; $_arraysign[] = ''; $