Jump to content

MissionSix

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

MissionSix's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. So when i point my browser to: /media/image/30/ for example, my media handler will take "30" as the imageid, and query the db for an image from the images table. it will grab the path from there. So then my mediahandler returns an image object. this object reads the mime type of the file, and sends that header to the browser. from here it will check to see if using a thumb (a thumb would be if the width or height are smaller than the origional width / height) is required, for example: /media/image/30/?w=120 the mediaHandler class would then read the width, $w and check to see if a thumbnail exists on the disk for that width (named something like: th.120.0.filename.jpg )**. If it does, it will read the path of the thumbnail and "send the file to the browser". if a thumb check fails for the width, then it will require the gd library to resize the image and output that to the browser. It will also then store the thumb on the disk and time stamp it in the db as well. a cron job will cleanup all thumbnails after x time expires, and this would probably run nightly. The problem I am having trouble with at the moment is redirecting the script to the file directly without giving away the path of the file. If someone could help with an example that'd be great. notes >> * I would do something like this: $pieces = explode(".", "th.120.0.filename.jpg"); // which -> $width = $pieces[1]; $height = $pieces[2]; $ext = $pieces[4]; // or reverse:: if(file_exists("th.". $width .".". $height .".". $filename .".". $ext) { }
  2. Some background notes: So i'm building an OO based media management system for my website and i'm having trouble with the following... example url: /media/image/3252/ My mediaHandler can recognize what type of file needs, via the URL, to be downloaded or send, such as an image object for example, or a .zip file. The ID is sent read from the URL as well so it knows where to look in the DB. The mediaHandler then grabs the file and returns and appropriate fileObject. It also checks the referrer (to eliminate leechers) and updates the download count / hit count in the db. In the example URL i'm trying to get an image, so an imageObject would be returned. The image Object has a filepath, filename, width and height, among other things. My mediaHandler also can take a width or a height as an argument and, using the gd library, create a resize & logo branded output image. An image object (which is a child of a file object), has the contents of the file as one of its properties**. If an image is not to be resized, the handler is supposed to just pass the image (i think via headers) to the browser. // This is where i need help, i can't figure this out.... If theres a manipulation to be made, the image needs to be manipulated, cached and stored cache in the db, and then sent to the output to the browser. **don't know if this is useful but i thought it might be. The question... I would like to know if there is a way to "pass the file" through my media handler without using GD to create a blank image and using up more memory it should be. I know theres a way with headers or something but I'm struggling to find an answer...
×
×
  • 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.