Jump to content

Request for Required Article Image


holycow90

Recommended Posts

The first image uploaded when new content is submitted is the article image, it would be nice to have a seperate section (above Title field) for an article image.  Both a browse and a Text URL Path to an image (so users don't have to save it locally from another site to reupload it)

 

Not sure if this helps but I came up with the code to do this in phpbb - not sure if it helps or not but here it is.  This submits the image into a database (which in retrospect was a bad decision to have blob pictures).

 

$content = base64_encode(file_get_contents($_POST['remoteimageURL']));

$fileName = basename($_POST['remoteimageURL']);

$fileSize = strlen($content);

 

if (strpos($fileName, 'jpg')  > 0 ) {

$fileType = "image/jpeg";

} else  {

if (strpos($fileName, 'jpeg')    > 0) {

$fileType = "image/jpeg";

} else {

if (strpos($fileName, 'gif')  > 0){

$fileType = "image/gif";

} else {

if (strpos($fileName, 'png')  > 0 ){

$fileType = "image/png";

} else {

if (strpos($fileName, 'bmp')  > 0 ) {

$fileType = "image/bmp";

}}}}}

 

}

 

$rawimage = $content;

 

Thats the raw image in the variable - I am assuming you could just write that out to a local file.  I also the base64_encode is only if it is going into a database.

Link to comment
×
×
  • Create New...