Jump to content

crittope

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by crittope

  1. Hello, I'm looking to have short video advertisements to play before accessing a certain feature of my website. I've never messed around with advertisement before so I don't exactly know what company that I should be going with. Could somebody point me in the right direction? Thanks.
  2. The base64-encode was a last ditch effort in an attempt to find a working solution to my problem. It didn't help. Here is some of the code that I'm using in an attempt to achieve my goal. This function just retreives the image from the inputted url. Clearly, when I'm using this I have a valid image url. $img = FetchImage("http://example.com/no/image/here.jpg"); function FetchImage($url) { $fetch = curl_init(); curl_setopt($fetch, CURLOPT_URL, $url); curl_setopt($fetch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($fetch, CURLOPT_RETURNTRANSFER, true); curl_setopt($fetch, CURLOPT_FORBID_REUSE, true); curl_setopt($fetch, CURLOPT_FRESH_CONNECT, true); curl_setopt($fetch, CURLOPT_CONNECTTIMEOUT, 60); curl_setopt($fetch, CURLOPT_BINARYTRANSFER, 1); $data = curl_exec($fetch); curl_close($fetch); return base64_encode($data); } After this function is called the binary image data is inserted into my database as a blob (which I know is getting inserted correctly as I'm using prepared statements and using send_long_data for the image). I have tested echoing out the binary image data right after downloading it and the image showed up perfectly, but once it was inserted into the database it became blurry and fragmented (top half or bottom half is just missing). Here is my mysql insert query: if($query = $database->connection->prepare("INSERT INTO media (hidden, hidden, hidden, hidden, hidden, hidden, hidden, image, hidden) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)")) { $query->bind_param("sbssssbbs", $hidden, $hidden, $hidden, $hidden, $hidden, $hidden,$hidden, $tmp['image'], $hidden); $query->send_long_data(7, $tmp['image']); $query->execute(); $result = $query->affected_rows; if(isset($query->error)) printf("Error Message: %s<br>", $query->error); $query->close(); } Suggestions?
  3. Hello, I'm looking to avoid storing flat files of images for a specific reason. I have nearly 500 images that I wish to store into my database to display on my website. I'm able to obviously get the binary data for the image using curl and encode it using base64. However, when I'm going to display the images they either have extremely noticeable quality loss, or corrupts and only displays half of the image. Granted, the images that I'm using are 960x540px with a file size that could be up to nearly 300kb. Is there any reason for my quality loss when attempting to encode/decode using base64?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.